Skip to main content

install_stdlib

Function install_stdlib 

Source
pub fn install_stdlib(interp: &mut Interpreter<ScriptCtx>, ctx: &mut ScriptCtx)
Expand description

Install every stdlib family. Three layers, in order:

  1. Rust primitives (install_primitives): arithmetic, comparison, list/string/IO — +, =, car, cons, length, reverse, string-format, print-line, read-file, …
  2. Higher-order Rust primitives (install_hof): map, filter, reduce, foldl, foldr, for-each, apply, find, every?, any?, partition, group-by, sort-by, iterate, take-while, drop-while, remove, count-if, find-index, scan-left, repeatedly, some.
  3. Typed map/dict primitives (install_map): (map ...) value constructor + accessors (alist-get, etc.).

Then the FFI families (cli/fs/http/json/regex/sops/…). Finally, the pure-Lisp stdlib (install_lisp_stdlib_with) which adds compose, pipe, ->, ->>, when-let, dotimes, dolist, defflow, inc, dec, even?, odd?, first/second/third, range, zip, interleave, flatten, distinct, max-by, min-by, partial, juxt, tap, not=, some?, not-empty?.

Scripts see the full Clojure-flavored environment without calling any of these installers themselves.