JanetDocsSourcePlaygroundTutorialsI'm Feeling luckyCommunityGitHub sign in

all-bindings

core-api


    function
    boot.janet on line 3227, column 1

    (all-bindings &opt env local)

    Get all symbols available in an environment. Defaults to the 
    current fiber's environment. If `local` is truthy, will not show 
    inherited bindings (from prototype tables).


3 examplesSign in to add an example
Loading...
  (->> (all-bindings)
       (keep (fn [sym]
               (when (string/has-prefix? "peg/" (string sym))
                 (string sym))))
       sort)

  # =>
  @["peg/compile"
    "peg/find"
    "peg/find-all"
    "peg/match"
    "peg/replace"
    "peg/replace-all"]

# from https://github.com/sogaiu/margaret/blob/master/tutorials/tutorial.janet
veqqqPlayground
(pp (all-bindings))
# => prints @[% %= * ... yield zero? zipcoll]

(def a "A")
(pp (all-bindings (curenv) true))
# => prints @[_ a] - only local bindings are listed
pepePlayground
(filter (partial string/has-prefix? "z") (all-bindings))  # => @[zero? zipcoll]
cellularmitosisPlayground