Created
November 30, 2025 14:40
-
-
Save sogaiu/4a88947762553dc20fdf276b7dc8cb1e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| value (def) | |
| src/janet/src/boot/boot.janet on line 11, column 3 | |
| defn | |
| (defn name & more) | |
| Define a function. Equivalent to `(def name (fn name [args] ...))`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 47, column 3 | |
| (defmacro name & more) | |
| Define a macro. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 53, column 3 | |
| (as-macro f & args) | |
| Use a function or macro literal `f` as a macro. This lets any | |
| function be used as a macro. Inside a quasiquote, the idiom | |
| `(as-macro ,my-custom-macro arg1 arg2...)` can be used to avoid | |
| unwanted variable capture of `my-custom-macro`. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 61, column 3 | |
| (defmacro- name & more) | |
| Define a private macro that will not be exported. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 66, column 3 | |
| (defn- name & more) | |
| Define a private function that will not be exported. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 71, column 3 | |
| (def- name & more) | |
| Define a private value that will not be exported. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 76, column 3 | |
| (var- name & more) | |
| Define a private var that will not be exported. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 81, column 3 | |
| (toggle value) | |
| Set a value to its boolean inverse. Same as `(set value (not | |
| value))`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 86, column 3 | |
| (defglobal name value) | |
| Dynamically create a global def. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 93, column 3 | |
| (varglobal name init) | |
| Dynamically create a global var. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 100, column 12 | |
| (nan? x) | |
| Check if x is NaN. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 101, column 15 | |
| (number? x) | |
| Check if x is a number. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 102, column 14 | |
| (fiber? x) | |
| Check if x is a fiber. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 103, column 15 | |
| (string? x) | |
| Check if x is a string. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 104, column 15 | |
| (symbol? x) | |
| Check if x is a symbol. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 105, column 16 | |
| (keyword? x) | |
| Check if x is a keyword. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 106, column 15 | |
| (buffer? x) | |
| Check if x is a buffer. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 107, column 17 | |
| (function? x) | |
| Check if x is a function (not a cfunction). | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 108, column 18 | |
| (cfunction? x) | |
| Check if x a cfunction. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 109, column 14 | |
| (table? x) | |
| Check if x a table. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 110, column 15 | |
| (struct? x) | |
| Check if x a struct. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 111, column 14 | |
| (array? x) | |
| Check if x is an array. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 112, column 14 | |
| (tuple? x) | |
| Check if x is a tuple. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 113, column 16 | |
| (boolean? x) | |
| Check if x is a boolean. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 114, column 15 | |
| (truthy? x) | |
| Check if x is truthy. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 115, column 13 | |
| (true? x) | |
| Check if x is true. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 116, column 14 | |
| (false? x) | |
| Check if x is false. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 117, column 12 | |
| (nil? x) | |
| Check if x is nil. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 118, column 14 | |
| (empty? xs) | |
| Check if xs is empty. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 132, column 3 | |
| (idempotent? x) | |
| Check if x is a value that evaluates to itself when compiled. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 137, column 11 | |
| (inc x) | |
| Returns x + 1. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 138, column 11 | |
| (dec x) | |
| Returns x - 1. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 139, column 14 | |
| (++ x) | |
| Increments the var x by 1. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 140, column 14 | |
| (-- x) | |
| Decrements the var x by 1. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 141, column 14 | |
| (+= x & ns) | |
| Increments the var x by n. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 142, column 14 | |
| (-= x & ns) | |
| Decrements the var x by n. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 143, column 14 | |
| (*= x & ns) | |
| Shorthand for (set x (* x n)). | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 144, column 14 | |
| (/= x & ns) | |
| Shorthand for (set x (/ x n)). | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 145, column 14 | |
| (%= x & ns) | |
| Shorthand for (set x (% x n)). | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 148, column 3 | |
| (assert x &opt err) | |
| Throw an error if x is not truthy. Will not evaluate `err` if x is | |
| truthy. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 158, column 3 | |
| (defdyn alias & more) | |
| Define an alias for a keyword that is used as a dynamic binding. | |
| The alias is a normal, lexically scoped binding that can be used | |
| instead of a keyword to prevent typos. `defdyn` does not set | |
| dynamic bindings or otherwise replace `dyn` and `setdyn`. The alias | |
| *must* start and end with the `*` character, usually called | |
| "earmuffs". | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 172, column 3 | |
| *macro-form* | |
| Inside a macro, is bound to the source form that invoked the macro | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 175, column 3 | |
| *flychecking* | |
| Check if the current form is being evaluated inside `flycheck`. | |
| Will be `true` while flychecking. | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 178, column 3 | |
| *lint-error* | |
| The current lint error level. The error level is the lint level at | |
| which compilation will exit with an error and not continue. | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 181, column 3 | |
| *lint-warn* | |
| The current lint warning level. The warning level is the lint level | |
| at which and error will be printed but compilation will continue as | |
| normal. | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 184, column 3 | |
| *lint-levels* | |
| A table of keyword alias to numbers denoting a lint level. Can be | |
| used to provided custom aliases for numeric lint levels. | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 187, column 3 | |
| *macro-lints* | |
| Bound to an array of lint messages that will be reported by the | |
| compiler inside a macro. To indicate an error or warning, a macro | |
| author should use `maclintf`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 191, column 3 | |
| (maclintf level fmt & args) | |
| When inside a macro, call this function to add a linter warning. | |
| Takes a `fmt` argument like `string/format`, which is used to | |
| format the message. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 206, column 3 | |
| (errorf fmt & args) | |
| A combination of `error` and `string/format`. Equivalent to `(error | |
| (string/format fmt ;args))`. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 211, column 3 | |
| (assertf x fmt & args) | |
| Convenience macro that combines `assert` and `string/format`. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 221, column 3 | |
| (default sym val) | |
| Define a default value for an optional argument. Expands to `(def | |
| sym (if (= nil sym) val sym))`. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 227, column 3 | |
| (comment &) | |
| Ignores the body of the comment. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 231, column 3 | |
| (if-not condition then &opt else) | |
| Shorthand for `(if (not condition) else then)`. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 236, column 3 | |
| (when condition & body) | |
| Evaluates the body when the condition is true. Otherwise returns | |
| nil. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 241, column 3 | |
| (unless condition & body) | |
| Shorthand for `(when (not condition) ;body)`. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 246, column 3 | |
| (cond & pairs) | |
| Evaluates conditions sequentially until the first true condition is | |
| found, and then executes the corresponding body. If there are an | |
| odd number of forms, and no forms are matched, the last expression | |
| is executed. If there are no matches, returns nil. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 261, column 3 | |
| (case dispatch & pairs) | |
| Select the body that equals the dispatch value. When `pairs` has an | |
| odd number of elements, the last is the default expression. If no | |
| match is found, returns nil. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 281, column 3 | |
| (let bindings & body) | |
| Create a scope and bind values to symbols. Each pair in `bindings` | |
| is assigned as if with `def`, and the body of the `let` form | |
| returns the last value. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 297, column 3 | |
| (protect & body) | |
| Evaluate expressions, while capturing any errors. Evaluates to a | |
| tuple of two elements. The first element is true if successful, | |
| false if an error, and the second is the return value or error. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 307, column 3 | |
| (and & forms) | |
| Evaluates to the last argument if all preceding elements are | |
| truthy, otherwise evaluates to the first falsey argument. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 325, column 3 | |
| (or & forms) | |
| Evaluates to the last argument if all preceding elements are | |
| falsey, otherwise evaluates to the first truthy element. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 343, column 3 | |
| (try body catch) | |
| Try something and catch errors. `body` is any expression, and | |
| `catch` should be a form, the first element of which is a tuple. | |
| This tuple should contain a binding for errors and an optional | |
| binding for the fiber wrapping the body. Returns the result of | |
| `body` if no error, or the result of `catch` if an error. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 363, column 3 | |
| (with-syms syms & body) | |
| Evaluates `body` with each symbol in `syms` bound to a generated, | |
| unique symbol. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 374, column 3 | |
| (defer form & body) | |
| Run `form` unconditionally after `body`, even if the body throws an | |
| error. Will also run `form` if a user signal 0-4 is received. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 387, column 3 | |
| (edefer form & body) | |
| Run `form` after `body` in the case that body terminates abnormally | |
| (an error or user signal 0-4). Otherwise, return last form in | |
| `body`. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 399, column 3 | |
| (prompt tag & body) | |
| Set up a checkpoint that can be returned to. `tag` should be a | |
| value that is used in a `return` statement, like a keyword. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 412, column 3 | |
| (chr c) | |
| Convert a string of length 1 to its byte (ascii) value at compile | |
| time. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 419, column 3 | |
| (label name & body) | |
| Set a label point that is lexically scoped. `name` should be a | |
| symbol that will be bound to the label. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 427, column 3 | |
| (return to &opt value) | |
| Return to a prompt point. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 432, column 3 | |
| (with [binding ctor dtor] & body) | |
| Evaluate `body` with some resource, which will be automatically | |
| cleaned up if there is an error in `body`. `binding` is bound to | |
| the expression `ctor`, and `dtor` is a function or callable that is | |
| passed the binding. If no destructor (`dtor`) is given, will call | |
| :close on the resource. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 442, column 3 | |
| (when-with [binding ctor dtor] & body) | |
| Similar to with, but if binding is false or nil, returns nil | |
| without evaluating the body. Otherwise, the same as `with`. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 449, column 3 | |
| (if-with [binding ctor dtor] truthy &opt falsey) | |
| Similar to `with`, but if binding is false or nil, evaluates the | |
| falsey path. Otherwise, evaluates the truthy path. In both cases, | |
| `ctor` is bound to binding. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 561, column 3 | |
| (forv i start stop & body) | |
| Do a C-style for-loop for side effects. The iteration variable `i` | |
| can be mutated in the loop, unlike normal `for`. Returns nil. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 567, column 3 | |
| (for i start stop & body) | |
| Do a C-style for-loop for side effects. Returns nil. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 572, column 3 | |
| (eachk x ds & body) | |
| Loop over each key in `ds`. Returns nil. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 577, column 3 | |
| (eachp x ds & body) | |
| Loop over each (key, value) pair in `ds`. Returns nil. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 582, column 3 | |
| (repeat n & body) | |
| Evaluate body n times. If n is negative, body will be evaluated 0 | |
| times. Evaluates to nil. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 588, column 3 | |
| (forever & body) | |
| Evaluate body forever in a loop, or until a break statement. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 593, column 3 | |
| (each x ds & body) | |
| Loop over each value in `ds`. Returns nil. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 603, column 3 | |
| (loop head & body) | |
| A general purpose loop macro. This macro is similar to the Common | |
| Lisp loop macro, although intentionally much smaller in scope. The | |
| head of the loop should be a tuple that contains a sequence of | |
| either bindings or conditionals. A binding is a sequence of three | |
| values that define something to loop over. Bindings are written in | |
| the format: | |
| binding :verb object/expression | |
| where `binding` is a binding as passed to def, `:verb` is one of a | |
| set of keywords, and `object` is any expression. Each subsequent | |
| binding creates a nested loop within the loop created by the | |
| previous binding. | |
| The available verbs are: | |
| * `:iterate` -- repeatedly evaluate and bind to the expression | |
| while it is truthy. | |
| * `:range` -- loop over a range. The object should be a two-element | |
| tuple with a start and end value, and an optional positive step. | |
| The range is half open, [start, end). | |
| * `:range-to` -- same as :range, but the range is inclusive [start, | |
| end]. | |
| * `:down` -- loop over a range, stepping downwards. The object | |
| should be a two-element tuple with a start and (exclusive) end | |
| value, and an optional (positive!) step size. | |
| * `:down-to` -- same as :down, but the range is inclusive [start, | |
| end]. | |
| * `:keys` -- iterate over the keys in a data structure. | |
| * `:pairs` -- iterate over the key-value pairs as tuples in a data | |
| structure. | |
| * `:in` -- iterate over the values in a data structure or fiber. | |
| `loop` also accepts conditionals to refine the looping further. | |
| Conditionals are of the form: | |
| :modifier argument | |
| where `:modifier` is one of a set of keywords, and `argument` is | |
| keyword-dependent. `:modifier` can be one of: | |
| * `:while expression` -- breaks from the current loop if | |
| `expression` is falsey. | |
| * `:until expression` -- breaks from the current loop if | |
| `expression` is truthy. | |
| * `:let bindings` -- defines bindings inside the current loop as | |
| passed to the `let` macro. | |
| * `:before form` -- evaluates a form for a side effect before the | |
| next inner loop. | |
| * `:after form` -- same as `:before`, but the side effect happens | |
| after the next inner loop. | |
| * `:repeat n` -- repeats the next inner loop `n` times. | |
| * `:when condition` -- only evaluates the current loop body when | |
| `condition` is truthy. | |
| * `:unless condition` -- only evaluates the current loop body when | |
| `condition` is falsey. | |
| The `loop` macro always evaluates to nil. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 676, column 3 | |
| (seq head & body) | |
| Similar to `loop`, but accumulates the loop body into an array and | |
| returns that. See `loop` for details. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 684, column 3 | |
| (catseq head & body) | |
| Similar to `loop`, but concatenates each element from the loop body | |
| into an array and returns that. See `loop` for details. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 692, column 3 | |
| (tabseq head key-body & value-body) | |
| Similar to `loop`, but accumulates key value pairs into a table. | |
| See `loop` for details. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 699, column 3 | |
| (generate head & body) | |
| Create a generator expression using the `loop` syntax. Returns a | |
| fiber that yields all values inside the loop in order. See `loop` | |
| for details. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 706, column 3 | |
| (coro & body) | |
| A wrapper for making fibers that may yield multiple values | |
| (coroutine). Same as `(fiber/new (fn [] ;body) :yi)`. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 711, column 3 | |
| (fiber-fn flags & body) | |
| A wrapper for making fibers. Same as `(fiber/new (fn [] ;body) | |
| flags)`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 716, column 3 | |
| (sum xs) | |
| Returns the sum of xs. If xs is empty, returns 0. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 723, column 3 | |
| (mean xs) | |
| Returns the mean of xs. If empty, returns NaN. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 733, column 3 | |
| (geomean xs) | |
| Returns the geometric mean of xs. If empty, returns NaN. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 746, column 3 | |
| (product xs) | |
| Returns the product of xs. If xs is empty, returns 1. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 756, column 3 | |
| (if-let bindings tru &opt fal) | |
| Make multiple bindings, and if all are truthy, evaluate the `tru` | |
| form. If any are false or nil, evaluate the `fal` form. Bindings | |
| have the same syntax as the `let` macro. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 778, column 3 | |
| (when-let bindings & body) | |
| Same as `(if-let bindings (do ;body))`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 783, column 3 | |
| (comp & functions) | |
| Takes multiple functions and returns a function that is the | |
| composition of those functions. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 797, column 3 | |
| (identity x) | |
| A function that returns its argument. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 802, column 3 | |
| (complement f) | |
| Returns a function that is the complement to the argument. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 818, column 3 | |
| (extreme order args) | |
| Returns the most extreme value in `args` based on the function | |
| `order`. `order` should take two values and return true or false (a | |
| comparison). Returns nil if `args` is empty. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 824, column 3 | |
| (max & args) | |
| Returns the numeric maximum of the arguments. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 828, column 3 | |
| (min & args) | |
| Returns the numeric minimum of the arguments. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 832, column 3 | |
| (max-of args) | |
| Returns the numeric maximum of the argument sequence. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 836, column 3 | |
| (min-of args) | |
| Returns the numeric minimum of the argument sequence. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 840, column 3 | |
| (first xs) | |
| Get the first element from an indexed data structure. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 845, column 3 | |
| (last xs) | |
| Get the last element from an indexed data structure. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 870, column 3 | |
| (compare x y) | |
| Polymorphic compare. Returns -1, 0, 1 for x < y, x = y, x > y | |
| respectively. Differs from the primitive comparators in that it | |
| first checks to see whether either x or y implement a `compare` | |
| method which can compare x and y. If so, it uses that method. If | |
| not, it delegates to the primitive comparators. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 890, column 3 | |
| (compare= & xs) | |
| Equivalent of `=` but using polymorphic `compare` instead of | |
| primitive comparator. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 895, column 3 | |
| (compare< & xs) | |
| Equivalent of `<` but using polymorphic `compare` instead of | |
| primitive comparator. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 900, column 3 | |
| (compare<= & xs) | |
| Equivalent of `<=` but using polymorphic `compare` instead of | |
| primitive comparator. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 905, column 3 | |
| (compare> & xs) | |
| Equivalent of `>` but using polymorphic `compare` instead of | |
| primitive comparator. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 910, column 3 | |
| (compare>= & xs) | |
| Equivalent of `>=` but using polymorphic `compare` instead of | |
| primitive comparator. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 914, column 13 | |
| (zero? x) | |
| Check if x is zero. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 915, column 12 | |
| (pos? x) | |
| Check if x is greater than 0. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 916, column 12 | |
| (neg? x) | |
| Check if x is less than 0. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 917, column 12 | |
| (one? x) | |
| Check if x is equal to 1. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 918, column 13 | |
| (even? x) | |
| Check if x is even. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 919, column 12 | |
| (odd? x) | |
| Check if x is odd. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 966, column 3 | |
| (sort ind &opt before?) | |
| Sorts `ind` in-place, and returns it. Uses quick-sort and is not a | |
| stable sort. If a `before?` comparator function is provided, sorts | |
| elements using that, otherwise uses `<`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 974, column 3 | |
| (sort-by f ind) | |
| Sorts `ind` in-place by calling a function `f` on each element and | |
| comparing the result with `<`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 980, column 3 | |
| (sorted ind &opt before?) | |
| Returns a new sorted array without modifying the old one. If a | |
| `before?` comparator function is provided, sorts elements using | |
| that, otherwise uses `<`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 987, column 3 | |
| (sorted-by f ind) | |
| Returns a new sorted array that compares elements by invoking a | |
| function `f` on each element and comparing the result with `<`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 993, column 3 | |
| (reduce f init ind) | |
| Reduce, also know as fold-left in many languages, transforms an | |
| indexed type (array, tuple) with a function to produce a value by | |
| applying `f` to each element in order. `f` is a function of 2 | |
| arguments, `(f accum el)`, where `accum` is the initial value and | |
| `el` is the next value in the indexed type `ind`. `f` returns a | |
| value that will be used as `accum` in the next call to `f`. | |
| `reduce` returns the value of the final call to `f`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1005, column 3 | |
| (reduce2 f ind) | |
| The 2-argument version of `reduce` that does not take an | |
| initialization value. Instead, the first element of the array is | |
| used for initialization. If `ind` is empty, will evaluate to nil. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1018, column 3 | |
| (accumulate f init ind) | |
| Similar to `reduce`, but accumulates intermediate values into an | |
| array. The last element in the array is what would be the return | |
| value from `reduce`. The `init` value is not added to the array | |
| (the return value will have the same number of elements as `ind`). | |
| Returns a new array. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1030, column 3 | |
| (accumulate2 f ind) | |
| The 2-argument version of `accumulate` that does not take an | |
| initialization value. The first value in `ind` will be added to the | |
| array as is, so the length of the return value will be `(length | |
| ind)`. | |
| -------------------------------------------------------------------- | |
| macro (defmacro-) | |
| src/janet/src/boot/boot.janet on line 1047, column 3 | |
| (map-aggregator maptype res val) | |
| Aggregation logic for various map functions. | |
| -------------------------------------------------------------------- | |
| macro (defmacro-) | |
| src/janet/src/boot/boot.janet on line 1058, column 3 | |
| (map-n n maptype res f ind inds) | |
| Generates efficient map logic for a specific number of indexed | |
| beyond the first. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1094, column 3 | |
| (map f ind & inds) | |
| Map a function `f` over every value in a data structure `ind` and | |
| return an array of results, but only if no `inds` are provided. | |
| Multiple data structures can be handled if each `inds` is a data | |
| structure and `f` is a function of arity one more than the number | |
| of `inds`. The resulting array has a length that is the shortest of | |
| `ind` and each of `inds`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1108, column 3 | |
| (mapcat f ind & inds) | |
| Map a function `f` over every value in a data structure `ind` and | |
| use `array/concat` to concatenate the results, but only if no | |
| `inds` are provided. Multiple data structures can be handled if | |
| each `inds` is a data structure and `f` is a function of arity one | |
| more than the number of `inds`. Note that `f` is only applied to | |
| values at indeces up to the largest index of the shortest of `ind` | |
| and each of `inds`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1123, column 3 | |
| (filter pred ind) | |
| Given a predicate, take only elements from an array or tuple for | |
| which `(pred element)` is truthy. Returns a new array. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1133, column 3 | |
| (count pred ind & inds) | |
| Count the number of values in a data structure `ind` for which | |
| applying `pred` yields a truthy value, but only if no `inds` are | |
| provided. Multiple data structures can be handled if each `inds` is | |
| a data structure and `pred` is a function of arity one more than | |
| the number of `inds`. Note that `pred` is only applied to values at | |
| indeces up to the largest index of the shortest of `ind` and each | |
| of `inds`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1148, column 3 | |
| (keep pred ind & inds) | |
| Given a predicate `pred`, return a new array containing the truthy | |
| results of applying `pred` to each value in the data structure | |
| `ind`, but only if no `inds` are provided. Multiple data structures | |
| can be handled if each `inds` is a data structure and `pred` is a | |
| function of arity one more than the number of `inds`. The resulting | |
| array has a length that is no longer than the shortest of `ind` and | |
| each of `inds`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1163, column 3 | |
| (find-index pred ind &opt dflt) | |
| Find the index of indexed type for which `pred` is true. Returns | |
| `dflt` if not found. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1177, column 3 | |
| (find pred ind &opt dflt) | |
| Find the first value in an indexed collection that satisfies a | |
| predicate. Returns `dflt` if not found. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1192, column 3 | |
| (index-of x ind &opt dflt) | |
| Find the first key associated with a value x in a data structure, | |
| acting like a reverse lookup. Will not look at table prototypes. | |
| Returns `dflt` if not found. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1212, column 3 | |
| (take n ind) | |
| Take the first n elements of a fiber, indexed or bytes type. | |
| Returns a new array, tuple or string, respectively. If `n` is | |
| negative, takes the last `n` elements instead. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1237, column 3 | |
| (take-until pred ind) | |
| Same as `(take-while (complement pred) ind)`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1246, column 3 | |
| (take-while pred ind) | |
| Given a predicate, take only elements from a fiber, indexed, or | |
| bytes type that satisfy the predicate, and abort on first failure. | |
| Returns a new array, tuple, or string, respectively. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1267, column 3 | |
| (drop n ind) | |
| Drop the first `n` elements in an indexed or bytes type. Returns a | |
| new tuple or string instance, respectively. If `n` is negative, | |
| drops the last `n` elements instead. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1295, column 3 | |
| (drop-until pred ind) | |
| Same as `(drop-while (complement pred) ind)`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1305, column 3 | |
| (drop-while pred ind) | |
| Given a predicate, remove elements from an indexed or bytes type | |
| that satisfy the predicate, and abort on first failure. Returns a | |
| new tuple or string, respectively. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1311, column 3 | |
| (juxt* & funs) | |
| Returns the juxtaposition of functions. In other words, `((juxt* a | |
| b c) x)` evaluates to `[(a x) (b x) (c x)]`. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 1321, column 3 | |
| (juxt & funs) | |
| Macro form of `juxt*`. Same behavior but more efficient. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1330, column 3 | |
| (has-key? ds key) | |
| Check if a data structure `ds` contains the key `key`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1335, column 3 | |
| (has-value? ds value) | |
| Check if a data structure `ds` contains the value `value`. Will run | |
| in time proportional to the size of `ds`. | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 1339, column 25 | |
| *defdyn-prefix* | |
| Optional namespace prefix to add to keywords declared with | |
| `defdyn`. Use this to prevent keyword collisions between dynamic | |
| bindings. | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 1341, column 15 | |
| *out* | |
| Where normal print functions print output to. | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 1342, column 15 | |
| *err* | |
| Where error printing prints output to. | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 1343, column 17 | |
| *redef* | |
| When set, allow dynamically rebinding top level defs. Will slow | |
| generated code and is intended to be used for development. | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 1344, column 17 | |
| *debug* | |
| Enables a built in debugger on errors and other useful features for | |
| debugging in a repl. | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 1345, column 16 | |
| *exit* | |
| When set, will cause the current context to complete. Can be set to | |
| exit from repl (or file), for example. | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 1346, column 22 | |
| *exit-value* | |
| Set the return value from `run-context` upon an exit. | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 1347, column 19 | |
| *task-id* | |
| When spawning a thread or fiber, the task-id can be assigned for | |
| concurrency control. | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 1350, column 3 | |
| *current-file* | |
| Bound to the name of the currently compiling file. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 1353, column 3 | |
| (tracev x) | |
| Print to stderr a value and a description of the form that produced | |
| that value. Evaluates to x. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1369, column 3 | |
| (keep-syntax before after) | |
| Creates a tuple with the tuple type and sourcemap of `before` but | |
| the elements of `after`. If either one of its arguments is not a | |
| tuple, returns `after` unmodified. Useful to preserve syntactic | |
| information when transforming an ast in macros. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1384, column 3 | |
| (keep-syntax! before after) | |
| Like `keep-syntax`, but if `after` is an array, it is coerced into | |
| a tuple. Useful to preserve syntactic information when transforming | |
| an ast in macros. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 1392, column 3 | |
| (-> x & forms) | |
| Threading macro. Inserts x as the second value in the first form in | |
| `forms`, and inserts the modified first form into the second form | |
| in the same manner, and so on. Useful for expressing pipelines of | |
| data. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 1405, column 3 | |
| (->> x & forms) | |
| Threading macro. Inserts x as the last value in the first form in | |
| `forms`, and inserts the modified first form into the second form | |
| in the same manner, and so on. Useful for expressing pipelines of | |
| data. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 1418, column 3 | |
| (-?> x & forms) | |
| Short circuit threading macro. Inserts x as the second value in the | |
| first form in `forms`, and inserts the modified first form into the | |
| second form in the same manner, and so on. The pipeline will return | |
| nil if an intermediate value is nil. Useful for expressing | |
| pipelines of data. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 1434, column 3 | |
| (-?>> x & forms) | |
| Short circuit threading macro. Inserts x as the last value in the | |
| first form in `forms`, and inserts the modified first form into the | |
| second form in the same manner, and so on. The pipeline will return | |
| nil if an intermediate value is nil. Useful for expressing | |
| pipelines of data. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1461, column 3 | |
| (walk f form) | |
| Iterate over the values in ast and apply `f` to them. Collect the | |
| results in a data structure. If ast is not a table, struct, array, | |
| or tuple, returns form. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1474, column 3 | |
| (postwalk f form) | |
| Do a post-order traversal of a data structure and call `(f x)` on | |
| every visitation. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1480, column 3 | |
| (prewalk f form) | |
| Similar to `postwalk`, but do pre-order traversal. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 1485, column 3 | |
| (as-> x as & forms) | |
| Thread forms together, replacing `as` in `forms` with the value of | |
| the previous form. The first form is the value x. Returns the last | |
| value. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 1497, column 3 | |
| (as?-> x as & forms) | |
| Thread forms together, replacing `as` in `forms` with the value of | |
| the previous form. The first form is the value x. If any | |
| intermediate values are falsey, return nil; otherwise, returns the | |
| last value. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 1510, column 3 | |
| (with-dyns bindings & body) | |
| Run a block of code in a new fiber that has some dynamic bindings | |
| set. The fiber will not mask errors or signals, but the dynamic | |
| bindings will be properly unset, as dynamic bindings are | |
| fiber-local. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 1521, column 3 | |
| (with-env env & body) | |
| Run a block of code with a given environment table | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 1526, column 3 | |
| (with-vars vars & body) | |
| Evaluates `body` with each var in `vars` temporarily bound. Similar | |
| signature to `let`, but each binding must be a var. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1544, column 3 | |
| (partial f & more) | |
| Partial function application. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1550, column 3 | |
| (every? ind) | |
| Evaluates to the last element of `ind` if all preceding elements | |
| are truthy, otherwise evaluates to the first falsey element. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1559, column 3 | |
| (any? ind) | |
| Evaluates to the last element of `ind` if all preceding elements | |
| are falsey, otherwise evaluates to the first truthy element. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1568, column 3 | |
| (reverse! t) | |
| Reverses the order of the elements in a given array or buffer and | |
| returns it mutated. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1581, column 3 | |
| (reverse t) | |
| Reverses the order of the elements in a given array or tuple and | |
| returns a new array. If a string or buffer is provided, returns a | |
| buffer instead. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1596, column 3 | |
| (invert ds) | |
| Given an associative data structure `ds`, returns a new table where | |
| the keys of `ds` are the values, and the values are the keys. If | |
| multiple keys in `ds` are mapped to the same value, only one of | |
| those values will become a key in the returned table. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1607, column 3 | |
| (zipcoll ks vs) | |
| Creates a table from two arrays/tuples. Returns a new table. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1622, column 3 | |
| (get-in ds ks &opt dflt) | |
| Access a value in a nested data structure. Looks into the data | |
| structure via a sequence of keys. If value is not found, and `dflt` | |
| is provided, returns `dflt`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1630, column 3 | |
| (update-in ds ks f & args) | |
| Update a value in a nested data structure `ds`. Looks into `ds` via | |
| a sequence of keys, and replaces the value found there with `f` | |
| applied to that value. Missing data structures will be replaced | |
| with tables. Returns the modified, original data structure. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1652, column 3 | |
| (put-in ds ks v) | |
| Put a value into a nested data structure `ds`. Looks into `ds` via | |
| a sequence of keys. Missing data structures will be replaced with | |
| tables. Returns the modified, original data structure. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1673, column 3 | |
| (update ds key func & args) | |
| For a given key in data structure `ds`, replace its corresponding | |
| value with the result of calling `func` on that value. If `args` | |
| are provided, they will be passed along to `func` as well. Returns | |
| `ds`, updated. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1681, column 3 | |
| (merge-into tab & colls) | |
| Merges multiple tables/structs into table `tab`. If a key appears | |
| in more than one collection in `colls`, then later values replace | |
| any previous ones. Returns `tab`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1690, column 3 | |
| (merge & colls) | |
| Merges multiple tables/structs into one new table. If a key appears | |
| in more than one collection in `colls`, then later values replace | |
| any previous ones. Returns the new table. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1701, column 3 | |
| (keys x) | |
| Get the keys of an associative data structure. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1714, column 3 | |
| (values x) | |
| Get the values of an associative data structure. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1727, column 3 | |
| (pairs x) | |
| Get the key-value pairs of an associative data structure. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1740, column 3 | |
| (frequencies ind) | |
| Get the number of occurrences of each value in an indexed data | |
| structure. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1749, column 3 | |
| (group-by f ind) | |
| Group elements of `ind` by a function `f` and put the results into | |
| a new table. The keys of the table are the distinct return values | |
| from calling `f` on the elements of `ind`. The values of the table | |
| are arrays of all elements of `ind` for which `f` called on the | |
| element equals that corresponding key. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1763, column 3 | |
| (partition-by f ind) | |
| Partition elements of a sequential data structure by a | |
| representative function `f`. Partitions split when `(f x)` changes | |
| values when iterating to the next element `x` of `ind`. Returns a | |
| new array of arrays. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1780, column 3 | |
| (interleave & cols) | |
| Returns an array of the first elements of each col, then the second | |
| elements, etc. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1785, column 3 | |
| (distinct xs) | |
| Returns an array of the deduplicated values in `xs`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1793, column 3 | |
| (flatten-into into xs) | |
| Takes a nested array (tree) `xs` and appends the depth first | |
| traversal of `xs` to array `into`. Returns `into`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1803, column 3 | |
| (flatten xs) | |
| Takes a nested array (tree) `xs` and returns the depth first | |
| traversal of it. Returns a new array. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1809, column 3 | |
| (kvs dict) | |
| Takes a table or struct and returns a new array of key value pairs | |
| like `@[k v k v ...]`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1817, column 3 | |
| (from-pairs ps) | |
| Takes a sequence of pairs and creates a table from each pair. It is | |
| the inverse of `pairs` on a table. Returns a new table. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1826, column 3 | |
| (interpose sep ind) | |
| Returns a sequence of the elements of `ind` separated by `sep`. | |
| Returns a new array. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1862, column 3 | |
| (partition n ind) | |
| Partition an indexed data structure `ind` into tuples of size `n`. | |
| Returns a new array. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1877, column 3 | |
| (slurp path) | |
| Read all data from a file with name `path` and then close the file. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1886, column 3 | |
| (spit path contents &opt mode) | |
| Write `contents` to a file at `path`. Can optionally append to the | |
| file. | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 1896, column 3 | |
| *pretty-format* | |
| Format specifier for the `pp` function | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 1899, column 3 | |
| *repl-prompt* | |
| Allow setting a custom prompt at the default REPL. Not all REPLs | |
| will respect this binding. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1902, column 3 | |
| (pp x) | |
| Pretty-print to stdout or `(dyn *out*)`. The format string used is | |
| `(dyn *pretty-format* "%q")`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 1908, column 3 | |
| (file/lines file) | |
| Return an iterator over the lines of a file. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 1921, column 3 | |
| (match x & cases) | |
| Pattern matching. Match an expression `x` against any number of | |
| cases. Each case is a pattern to match against, followed by an | |
| expression to evaluate to if that case is matched. Legal patterns | |
| are: | |
| * symbol -- a pattern that is a symbol will match anything, binding | |
| `x`'s value to that symbol. | |
| * array or bracket tuple -- an array or bracket tuple will match | |
| only if all of its elements match the corresponding elements in | |
| `x`. Use `& rest` at the end of an array or bracketed tuple to | |
| bind all remaining values to `rest`. | |
| * table or struct -- a table or struct will match if all values | |
| match with the corresponding values in `x`. | |
| * tuple -- a tuple pattern will match if its first element matches, | |
| and the following elements are treated as predicates and are | |
| true. | |
| * `_` symbol -- the last special case is the `_` symbol, which is a | |
| wildcard that will match any value without creating a binding. | |
| While a symbol pattern will ordinarily match any value, the pattern | |
| `(@ <sym>)`, where `<sym>` is any symbol, will attempt to match `x` | |
| against a value already bound to `<sym>`, rather than matching and | |
| rebinding it. | |
| Any other value pattern will only match if it is equal to `x`. | |
| Quoting a pattern with `'` will also treat the value as a literal | |
| value to match against. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2136, column 3 | |
| (macex1 x &opt on-binding) | |
| Expand macros in a form, but do not recursively expand macros. See | |
| `macex` docs for info on `on-binding`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2238, column 3 | |
| (all pred ind & inds) | |
| Returns true if applying `pred` to every value in a data structure | |
| `ind` results in only truthy values, but only if no `inds` are | |
| provided. Multiple data structures can be handled if each `inds` is | |
| a data structure and `pred` is a function of arity one more than | |
| the number of `inds`. Returns the first falsey result encountered. | |
| Note that `pred` is only called as many times as the length of the | |
| shortest of `ind` and each of `inds`. If `ind` or any of `inds` are | |
| empty, returns true. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2254, column 3 | |
| (some pred ind & inds) | |
| Returns nil if applying `pred` to every value in a data structure | |
| `ind` results in only falsey values, but only if no `inds` are | |
| provided. Multiple data structures can be handled if each `inds` is | |
| a data structure and `pred` is a function of arity one more than | |
| the number of `inds`. Returns the first truthy result encountered. | |
| Note that `pred` is only called as many times as the length of the | |
| shortest of `ind` and each of `inds`. If `ind` or any of `inds` are | |
| empty, returns nil. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2270, column 3 | |
| (freeze x) | |
| Freeze an object (make it immutable) and do a deep copy, making | |
| child values also immutable. Closures, fibers, and abstract types | |
| will not be recursively frozen, but all other types will. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2297, column 3 | |
| (thaw ds) | |
| Thaw an object (make it mutable) and do a deep copy, making child | |
| value also mutable. Closures, fibers, and abstract types will not | |
| be recursively thawed, but all other types will | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2310, column 3 | |
| (deep-not= x y) | |
| Like `not=`, but mutable types (arrays, tables, buffers) are | |
| considered equal if they have identical structure. Much slower than | |
| `not=`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2339, column 3 | |
| (deep= x y) | |
| Like `=`, but mutable types (arrays, tables, buffers) are | |
| considered equal if they have identical structure. Much slower than | |
| `=`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2345, column 3 | |
| (macex x &opt on-binding) | |
| Expand macros completely. `on-binding` is an optional callback for | |
| whenever a normal symbolic binding is encountered. This allows | |
| macros to easily see all bindings used by their arguments by | |
| calling `macex` on their contents. The binding itself is also | |
| replaced by the value returned by `on-binding` within the expanded | |
| macro. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 2364, column 3 | |
| (varfn name & body) | |
| Create a function that can be rebound. `varfn` has the same | |
| signature as `defn`, but defines functions in the environment as | |
| vars. If a var `name` already exists in the environment, it is | |
| rebound to the new function. Returns a function. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 2394, column 3 | |
| (short-fn arg &opt name) | |
| Shorthand for `fn`. Arguments are given as `$n`, where `n` is the | |
| 0-indexed argument of the function. `$` is also an alias for the | |
| first (index 0) argument. The `$&` symbol will make the anonymous | |
| function variadic if it appears in the body of the function, and | |
| can be combined with positional arguments. | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 2441, column 3 | |
| *peg-grammar* | |
| The implicit base grammar used when compiling PEGs. Any undefined | |
| keywords found when compiling a peg will use lookup in this table | |
| (if defined). | |
| -------------------------------------------------------------------- | |
| value (def) | |
| src/janet/src/boot/boot.janet on line 2445, column 3 | |
| default-peg-grammar | |
| The default grammar used for pegs. This grammar defines several | |
| common patterns that should make it easier to write more complex | |
| patterns. | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 2487, column 3 | |
| *syspath* | |
| Path of directory to load system modules from. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2495, column 3 | |
| (make-env &opt parent) | |
| Create a new environment table. The new environment will inherit | |
| bindings from the parent environment, but new bindings will not | |
| pollute the parent environment. | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 2504, column 3 | |
| *err-color* | |
| Whether or not to turn on error coloring in stacktraces and other | |
| error messages. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2507, column 3 | |
| (bad-parse p where) | |
| Default handler for a parse error. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2524, column 3 | |
| (warn-compile msg level where &opt line col) | |
| Default handler for a compile warning. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2539, column 3 | |
| (bad-compile msg macrof where &opt line col) | |
| Default handler for a compile error. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2556, column 3 | |
| (curenv &opt n) | |
| Get the current environment table. Same as `(fiber/getenv | |
| (fiber/current))`. If `n` is provided, gets the nth prototype of | |
| the environment table. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2571, column 3 | |
| (run-context opts) | |
| Run a context. This evaluates expressions in an environment, and | |
| encapsulates the parsing, compilation, and evaluation. Returns `(in | |
| environment :exit-value environment)` when complete. `opts` is a | |
| table or struct of options. The options are as follows: | |
| * `:chunks` -- callback to read into a buffer - default is getline | |
| * `:on-parse-error` -- callback when parsing fails - default is | |
| bad-parse | |
| * `:env` -- the environment to compile against - default is the | |
| current env | |
| * `:source` -- source path for better errors (use keywords for | |
| non-paths) - default is `:<anonymous>` | |
| * `:on-compile-error` -- callback when compilation fails - default | |
| is bad-compile | |
| * `:on-compile-warning` -- callback for any linting error - default | |
| is warn-compile | |
| * `:evaluator` -- callback that executes thunks. Signature is | |
| (evaluator thunk source env where) | |
| * `:on-status` -- callback when a value is evaluated - default is | |
| debug/stacktrace. | |
| * `:fiber-flags` -- what flags to wrap the compilation fiber with. | |
| Default is :ia. | |
| * `:expander` -- an optional function that is called on each top | |
| level form before being compiled. | |
| * `:parser` -- provide a custom parser that implements the same | |
| interface as Janet's built-in parser. | |
| * `:read` -- optional function to get the next form, called like | |
| `(read env source)`. Overrides all parsing. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2688, column 5 | |
| (parse-err p where) | |
| Handle parser error in the correct environment | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2744, column 3 | |
| (quit &opt value) | |
| Tries to exit from the current repl or run-context. Does not always | |
| exit the application. Works by setting the :exit dynamic binding to | |
| true. Passing a non-nil `value` here will cause the outer | |
| run-context to return that value. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2753, column 3 | |
| (eval form &opt env) | |
| Evaluates a form in the current environment. If more control over | |
| the environment is needed, use `run-context`. Optionally pass in an | |
| `env` table with available bindings. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2762, column 3 | |
| (parse str) | |
| Parse a string and return the first value. For complex parsing, | |
| such as for a repl with error handling, use the parser api. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2777, column 3 | |
| (parse-all str) | |
| Parse a string and return all parsed values. For complex parsing, | |
| such as for a repl with error handling, use the parser api. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2793, column 3 | |
| (eval-string str &opt env) | |
| Evaluates a string in the current environment. If more control over | |
| the environment is needed, use `run-context`. Optionally pass in an | |
| `env` table with available bindings. | |
| -------------------------------------------------------------------- | |
| value (def) | |
| src/janet/src/boot/boot.janet on line 2801, column 3 | |
| load-image-dict | |
| A table used in combination with `unmarshal` to unmarshal byte | |
| sequences created by `make-image`, such that `(load-image bytes)` | |
| is the same as `(unmarshal bytes load-image-dict)`. | |
| -------------------------------------------------------------------- | |
| value (def) | |
| src/janet/src/boot/boot.janet on line 2806, column 3 | |
| make-image-dict | |
| A table used in combination with `marshal` to marshal code | |
| (images), such that `(make-image x)` is the same as `(marshal x | |
| make-image-dict)`. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 2811, column 3 | |
| (comptime x) | |
| Evals x at compile time and returns the result. Similar to a top | |
| level unquote. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 2816, column 3 | |
| (compif cnd tru &opt fals) | |
| Check the condition `cnd` at compile time -- if truthy, compile | |
| `tru`, else compile `fals`. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 2823, column 3 | |
| (compwhen cnd & body) | |
| Check the condition `cnd` at compile time -- if truthy, compile | |
| `(upscope ;body)`, else compile nil. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2829, column 3 | |
| (make-image env) | |
| Create an image from an environment returned by `require`. Returns | |
| the image source as a string. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2835, column 3 | |
| (load-image image) | |
| The inverse operation to `make-image`. Returns an environment. | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 2845, column 24 | |
| *module-cache* | |
| Dynamic binding for overriding `module/cache` | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 2846, column 24 | |
| *module-paths* | |
| Dynamic binding for overriding `module/paths` | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 2847, column 26 | |
| *module-loading* | |
| Dynamic binding for overriding `module/loading` | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 2848, column 26 | |
| *module-loaders* | |
| Dynamic binding for overriding `module/loaders` | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 2849, column 27 | |
| *module-make-env* | |
| Dynamic binding for creating new environments for `import`, | |
| `require`, and `dofile`. Overrides `make-env`. | |
| -------------------------------------------------------------------- | |
| value (def) | |
| src/janet/src/boot/boot.janet on line 2852, column 3 | |
| module/cache | |
| A table, mapping loaded module identifiers to their environments. | |
| -------------------------------------------------------------------- | |
| value (def) | |
| src/janet/src/boot/boot.janet on line 2856, column 3 | |
| module/paths | |
| The list of paths to look for modules, templated for | |
| `module/expand-path`. Each element is a two-element tuple, | |
| containing the path template and a keyword :source, :native, or | |
| :image indicating how `require` should load files found at these | |
| paths. | |
| A tuple can also contain a third element, specifying a filter that | |
| prevents `module/find` from searching that path template if the | |
| filter doesn't match the input path. The filter can be a string or | |
| a predicate function, and is often a file extension, including the | |
| period. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2871, column 3 | |
| (module/add-paths ext loader) | |
| Add paths to `module/paths` for a given loader such that the | |
| generated paths behave like other module types, including relative | |
| imports and syspath imports. `ext` is the file extension to | |
| associate with this module type, including the dot. `loader` is the | |
| keyword name of a loader in `module/loaders`. Returns the modified | |
| `module/paths`. | |
| -------------------------------------------------------------------- | |
| function (defn-) | |
| src/janet/src/boot/boot.janet on line 2895, column 3 | |
| (module/add-syspath path) | |
| Add a custom syspath to `module/paths` by duplicating all entries | |
| that being with `:sys:` and adding duplicates with a specific path | |
| prefix instead. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2937, column 3 | |
| (module/find path) | |
| Try to match a module or path name from the patterns in | |
| `module/paths`. Returns a tuple (fullpath kind) where the kind is | |
| one of :source, :native, or :image if the module is found, | |
| otherwise a tuple with nil followed by an error message. | |
| -------------------------------------------------------------------- | |
| value (def) | |
| src/janet/src/boot/boot.janet on line 2967, column 3 | |
| module/loading | |
| A table, mapping currently loading modules to true. Used to prevent | |
| circular dependencies. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2972, column 3 | |
| (module/value module sym &opt private) | |
| Given a module table, get the value bound to a symbol `sym`. If | |
| `private` is truthy, will also resolve private module symbols. If | |
| no binding is found, will return nil. | |
| -------------------------------------------------------------------- | |
| value (def) | |
| src/janet/src/boot/boot.janet on line 2987, column 3 | |
| debugger-env | |
| An environment that contains dot prefixed functions for debugging. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 2993, column 3 | |
| (debugger fiber &opt level) | |
| Run a repl-based debugger on a fiber. Optionally pass in a level to | |
| differentiate nested debuggers. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3019, column 3 | |
| (debugger-on-status env &opt level is-repl) | |
| Create a function that can be passed to `run-context`'s | |
| `:on-status` argument that will drop into a debugger on errors. The | |
| debugger will only start on abnormal signals if the env table has | |
| the `:debug` dyn set to a truthy value. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3045, column 3 | |
| (dofile path &named exit env source expander evaluator read parser) | |
| Evaluate a file, file path, or stream and return the resulting | |
| environment. :env, :expander, :source, :evaluator, :read, and | |
| :parser are passed through to the underlying `run-context` call. If | |
| `exit` is true, any top level errors will trigger a call to | |
| `(os/exit 1)` after printing the error. | |
| -------------------------------------------------------------------- | |
| value (def) | |
| src/janet/src/boot/boot.janet on line 3112, column 3 | |
| module/loaders | |
| A table of loading method names to loading functions. This table | |
| lets `require` and `import` load many different kinds of files as | |
| modules. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3148, column 3 | |
| (require path & args) | |
| Require a module with the given name. Will search all of the paths | |
| in `module/paths`. Returns the new environment returned from | |
| compiling and running the file. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3155, column 3 | |
| (merge-module target source &opt prefix export only) | |
| Merge a module source into the `target` environment with a | |
| `prefix`, as with the `import` macro. This lets users emulate the | |
| behavior of `import` with a custom module table. If `export` is | |
| truthy, then merged functions are not marked as private. Returns | |
| the modified target environment. If a tuple or array `only` is | |
| passed, only merge keys in `only`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3167, column 3 | |
| (import* path & args) | |
| Function form of `import`. Same parameters, but the path and other | |
| symbol parameters should be strings instead. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 3184, column 3 | |
| (import path & args) | |
| Import a module. First requires the module, and then merges its | |
| symbols into the current environment, prepending a given prefix as | |
| needed. (use the :as or :prefix option to set a prefix). If no | |
| prefix is provided, use the name of the module as a prefix. One can | |
| also use "`:export true`" to re-export the imported symbols. If | |
| "`:exit true`" is given as an argument, any errors encountered at | |
| the top level in the module will cause `(os/exit 1)` to be called. | |
| Dynamic bindings will NOT be imported. Use :fresh with a truthy | |
| value to bypass the module cache. Use `:only [foo bar baz]` to only | |
| import select bindings into the current environment. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 3204, column 3 | |
| (use & modules) | |
| Similar to `import`, but imported bindings are not prefixed with a | |
| module identifier. Can also import multiple modules in one shot. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3228, column 3 | |
| (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). | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3235, column 3 | |
| (all-dynamics &opt env local) | |
| Get all dynamic bindings in an environment. Defaults to the current | |
| fiber's environment. If `local` is truthy, will not show inherited | |
| bindings (from prototype tables). | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 3243, column 3 | |
| *doc-width* | |
| Width in columns to print documentation printed with `doc-format`. | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 3246, column 3 | |
| *doc-color* | |
| Whether or not to colorize documentation printed with `doc-format`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3249, column 3 | |
| (doc-format str &opt width indent colorize) | |
| Reformat a docstring to wrap a certain width. Docstrings can either | |
| be plaintext or a subset of markdown. This allows a long single | |
| line of prose or formatted text to be a well-formed docstring. | |
| Returns a buffer containing the formatted text. | |
| -------------------------------------------------------------------- | |
| function (defn-) | |
| src/janet/src/boot/boot.janet on line 3513, column 3 | |
| (print-index fltr) | |
| Print bindings in the current environment given a filter function. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3552, column 3 | |
| (doc* &opt sym) | |
| Get the documentation for a symbol in a given environment. Function | |
| form of `doc`. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 3580, column 3 | |
| (doc &opt sym) | |
| Shows documentation for the given symbol, or can show a list of | |
| available bindings. If `sym` is a symbol, will look for | |
| documentation for that symbol. If `sym` is a string or is not | |
| provided, will show all lexical and dynamic bindings in the current | |
| environment containing that string (all bindings will be shown if | |
| no string is given). | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3588, column 3 | |
| (doc-of x) | |
| Searches all loaded modules in module/cache for a given binding and | |
| prints out its documentation. This does a search by value instead | |
| of by name. Returns nil. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3610, column 3 | |
| (.fiber ) | |
| Get the current fiber being debugged. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3615, column 3 | |
| (.signal ) | |
| Get the current signal being debugged. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3620, column 3 | |
| (.stack ) | |
| Print the current fiber stack. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3627, column 3 | |
| (.frame &opt n) | |
| Show a stack frame | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3633, column 3 | |
| (.locals &opt n) | |
| Show local bindings | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3638, column 3 | |
| (.fn &opt n) | |
| Get the current function. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3643, column 3 | |
| (.slots &opt n) | |
| Get an array of slots in a stack frame. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3648, column 3 | |
| (.slot &opt nth frame-idx) | |
| Get the value of the nth slot. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3656, column 5 | |
| (.disasm &opt n) | |
| Gets the assembly for the current function. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3663, column 5 | |
| (.bytecode &opt n) | |
| Get the bytecode for the current function. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3668, column 5 | |
| (.ppasm &opt n) | |
| Pretty prints the assembly for the current function. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3717, column 5 | |
| (.breakall &opt n) | |
| Set breakpoints on all instructions in the current function. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3726, column 5 | |
| (.clearall &opt n) | |
| Clear all breakpoints on the current function. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3735, column 3 | |
| (.source &opt n) | |
| Show the source code for the function being debugged. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3743, column 3 | |
| (.break ) | |
| Set breakpoint at the current pc. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3752, column 3 | |
| (.clear ) | |
| Clear the current breakpoint. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3761, column 3 | |
| (.next &opt n) | |
| Go to the next breakpoint. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3769, column 3 | |
| (.nextc &opt n) | |
| Go to the next breakpoint, clearing the current breakpoint. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3775, column 3 | |
| (.step &opt n) | |
| Execute the next n instructions. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3792, column 3 | |
| (repl &opt chunks onsignal env parser read) | |
| Run a repl. The first parameter is an optional function to call to | |
| get a chunk of source code that should return nil for end of file. | |
| The second parameter is a function that is called when a signal is | |
| caught. One can provide an optional environment table to run the | |
| repl in, as well as an optional parser or read function to pass to | |
| `run-context`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3824, column 19 | |
| (net/close stream) | |
| Alias for `ev/close`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3827, column 5 | |
| (ev/call f & args) | |
| Call a function asynchronously. Returns a fiber that is scheduled | |
| to run the function. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 3835, column 5 | |
| (ev/spawn & body) | |
| Run some code in a new fiber. This is shorthand for `(ev/go (fn [] | |
| ;body))`. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 3840, column 5 | |
| (ev/do-thread & body) | |
| Run some code in a new thread. Suspends the current fiber until the | |
| thread is complete, and evaluates to nil. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 3855, column 5 | |
| (ev/with-lock lock & body) | |
| Run a body of code after acquiring a lock. Will automatically | |
| release the lock when done. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 3860, column 5 | |
| (ev/with-rlock lock & body) | |
| Run a body of code after acquiring read access to an rwlock. Will | |
| automatically release the lock when done. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 3865, column 5 | |
| (ev/with-wlock lock & body) | |
| Run a body of code after acquiring write access to an rwlock. Will | |
| automatically release the lock when done. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 3870, column 5 | |
| (ev/spawn-thread & body) | |
| Run some code in a new thread. Like `ev/do-thread`, but returns nil | |
| immediately. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 3875, column 5 | |
| (ev/with-deadline sec & body) | |
| Create a fiber to execute `body`, schedule the event loop to cancel | |
| the task (root fiber) associated with `body`'s fiber, and start | |
| `body`'s fiber by resuming it. | |
| The event loop will try to cancel the root fiber if `body`'s fiber | |
| has not completed after at least `sec` seconds. | |
| `sec` is a number that can have a fractional part. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 3909, column 5 | |
| (ev/gather & bodies) | |
| Run a number of fibers in parallel on the event loop, and join when | |
| they complete. Returns the gathered results in an array. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3928, column 5 | |
| (net/server host port &opt handler type no-reuse) | |
| Starts a server with `net/listen`. Runs `net/accept-loop` | |
| asynchronously if `handler` is set and `type` is `:stream` (the | |
| default). It is invalid to set `handler` if `type` is `:datagram`. | |
| Returns the new server stream. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 3948, column 3 | |
| (delay & forms) | |
| Lazily evaluate a series of expressions. Returns a function that | |
| returns the result of the last expression. Will only evaluate the | |
| body once, and then memoizes the result. | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 3966, column 25 | |
| *ffi-context* | |
| Current native library for ffi/bind and other settings | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 3973, column 5 | |
| (ffi/context &opt native-path &named map-symbols lazy) | |
| Set the path of the dynamic library to implicitly bind, as well as | |
| other global state for ease of creating native bindings. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 3987, column 5 | |
| (ffi/defbind-alias name alias ret-type & body) | |
| Generate bindings for native functions in a convenient manner. | |
| Similar to defbind but allows for the janet function name to be | |
| different than the FFI function. | |
| -------------------------------------------------------------------- | |
| macro (defmacro) | |
| src/janet/src/boot/boot.janet on line 4015, column 5 | |
| (ffi/defbind name ret-type & body) | |
| Generate bindings for native functions in a convenient manner. | |
| -------------------------------------------------------------------- | |
| function (defn-) | |
| src/janet/src/boot/boot.janet on line 4028, column 3 | |
| (flycheck-evaluator thunk source env where) | |
| An evaluator function that is passed to `run-context` that lints | |
| (flychecks) code for `flycheck`. This means code will be parsed, | |
| compiled, and have macros expanded, but the code will not be | |
| evaluated. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 4048, column 3 | |
| (flycheck path &keys kwargs) | |
| Check a file for errors without running the file. Found errors will | |
| be printed to stderr in the usual format. Top level functions and | |
| macros that have the metadata `:flycheck` will also be evaluated | |
| during flychecking. For full control, the `:flycheck` metadata can | |
| also be a function that takes 4 arguments - `thunk`, `source`, | |
| `env`, and `where`, the same as the `:evaluator` argument to | |
| `run-context`. Other arguments to `flycheck` are the same as | |
| `dofile`. Returns nil. | |
| -------------------------------------------------------------------- | |
| function (defn-) | |
| src/janet/src/boot/boot.janet on line 4071, column 3 | |
| (no-side-effects src) | |
| Check if form may have side effects. If returns true, then the src | |
| must not have side effects, such as calling a C function. | |
| -------------------------------------------------------------------- | |
| function (defn-) | |
| src/janet/src/boot/boot.janet on line 4151, column 5 | |
| (rmrf x) | |
| rm -rf in janet | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 4200, column 5 | |
| (bundle/manifest bundle-name) | |
| Get the manifest for a given installed bundle. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 4246, column 5 | |
| (bundle/list ) | |
| Get a list of all installed bundles in lexical order. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 4270, column 5 | |
| (bundle/uninstall bundle-name) | |
| Remove a bundle from the current syspath. There is 1 hook called | |
| during uninstallation (uninstall). A user can register a hook by | |
| defining a function with the same name in the bundle script. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 4287, column 5 | |
| (bundle/topolist ) | |
| Get topological order of all bundles, such that each bundle is | |
| listed after its dependencies. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 4308, column 5 | |
| (bundle/prune ) | |
| Remove all orphaned bundles from the current syspath. An orphaned | |
| bundle is a bundle that is marked for :auto-remove and is not | |
| depended on by any other bundle. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 4333, column 5 | |
| (bundle/installed? bundle-name) | |
| Check if a bundle is installed. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 4338, column 5 | |
| (bundle/install path &keys config) | |
| Install a bundle from the local filesystem. The name of the bundle | |
| is the value mapped to :name in either `config` or the info file. | |
| There are 5 hooks called during installation (postdeps, clean, | |
| build, install and check). A user can register a hook by defining a | |
| function with the same name in the bundle script. | |
| -------------------------------------------------------------------- | |
| function (defn-) | |
| src/janet/src/boot/boot.janet on line 4419, column 5 | |
| (bundle/pack bundle-name dest-dir &opt is-backup) | |
| Take an installed bundle and create a bundle source directory that | |
| can be used to reinstall the bundle on a compatible system. This is | |
| used to create backups for installed bundles without rebuilding, or | |
| make a prebuilt bundle for other systems. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 4452, column 5 | |
| (bundle/replace bundle-name path &keys new-config) | |
| Reinstall an existing bundle from a new directory. Similar to | |
| bundle/reinstall, but installs the replacement bundle from any | |
| directory. This is necessary to replace a package without breaking | |
| any dependencies. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 4473, column 5 | |
| (bundle/reinstall bundle-name &keys new-config) | |
| Reinstall an existing bundle from the local source code. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 4481, column 5 | |
| (bundle/add-directory manifest dest &opt chmod-mode) | |
| Add a directory during an install relative to `(dyn *syspath*)`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 4496, column 5 | |
| (bundle/whois path) | |
| Given a file path, figure out which bundle installed it. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 4509, column 5 | |
| (bundle/add-file manifest src &opt dest chmod-mode) | |
| Add a file during an install relative to `(dyn *syspath*)`. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 4526, column 5 | |
| (bundle/add manifest src &opt dest chmod-mode) | |
| Add a file or directory during an install relative to `(dyn | |
| *syspath*)`. Added files and directories will be recorded in the | |
| bundle manifest such that they are properly tracked and removed | |
| during an upgrade or uninstall. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 4543, column 5 | |
| (bundle/add-bin manifest src &opt filename chmod-mode) | |
| Add a file to the "bin" subdirectory of the current syspath. By | |
| default, files will be set to be executable. | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 4555, column 5 | |
| (bundle/add-manpage manifest src &opt mansec) | |
| Add a file to the man subdirectory of the current syspath. Files | |
| are copied inside a directory `mansec`. By default, `mansec` is | |
| "man1". | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 4567, column 5 | |
| (bundle/update-all &keys configs) | |
| Reinstall all bundles. | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 4599, column 3 | |
| *args* | |
| Dynamic bindings that will contain command line arguments at | |
| program start. | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 4602, column 3 | |
| *executable* | |
| Name of the interpreter executable used to execute this program. | |
| Corresponds to `argv[0]` in the call to `int main(int argc, char | |
| **argv);`. | |
| -------------------------------------------------------------------- | |
| dynamic variable | |
| src/janet/src/boot/boot.janet on line 4606, column 3 | |
| *profilepath* | |
| Path to profile file loaded when starting up the repl. | |
| -------------------------------------------------------------------- | |
| value (def-) | |
| src/janet/src/boot/boot.janet on line 4612, column 3 | |
| long-to-short | |
| map long options to short options | |
| -------------------------------------------------------------------- | |
| function (defn) | |
| src/janet/src/boot/boot.janet on line 4640, column 3 | |
| (cli-main args) | |
| Entrance for the Janet CLI tool. Call this function with the | |
| command line arguments as an array or tuple of strings to invoke | |
| the CLI interface. | |
| -------------------------------------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment