def ns_map(ns): from pixie.vm.symbol import Symbol affirm(isinstance(ns, code.Namespace) or isinstance(ns, Symbol), u"ns must be a symbol or a namespace") if isinstance(ns, Symbol): ns = rt.the_ns(ns) if ns is nil: return nil m = rt.hashmap() for name in ns._registry: var = ns._registry.get(name, nil) m = rt.assoc(m, rt.symbol(rt.wrap(name)), var) return m
def ns_aliases(ns): from pixie.vm.symbol import Symbol affirm(isinstance(ns, Namespace) or isinstance(ns, Symbol), u"ns must be a symbol or a namespace") if isinstance(ns, Symbol): ns = rt.the_ns(ns) if ns is nil: return nil if isinstance(ns, Namespace): m = rt.hashmap() for alias in ns._refers: refered_ns = ns._refers[alias]._namespace m = rt.assoc(m, rt.symbol(rt.wrap(alias)), refered_ns) return m return nil
def ns_aliases(ns): from pixie.vm.symbol import Symbol affirm( isinstance(ns, Namespace) or isinstance(ns, Symbol), u"ns must be a symbol or a namespace") if isinstance(ns, Symbol): ns = rt.the_ns(ns) if ns is nil: return nil if isinstance(ns, Namespace): m = rt.hashmap() for alias in ns._refers: refered_ns = ns._refers[alias]._namespace m = rt.assoc(m, rt.symbol(rt.wrap(alias)), refered_ns) return m return nil
def ns_map(ns): from pixie.vm.symbol import Symbol affirm( isinstance(ns, Namespace) or isinstance(ns, Symbol), u"ns must be a symbol or a namespace") if isinstance(ns, Symbol): ns = rt.the_ns(ns) if ns is nil: return nil if isinstance(ns, Namespace): m = rt.hashmap() for name in ns._registry: var = ns._registry.get(name, nil) m = rt.assoc(m, rt.symbol(rt.wrap(name)), var) return m return nil