Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .site-sync/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"common-operation-script/substrate/README.md": "develop-business-logic/smart-contract-development/substrate",
"common-operation-script/substrate/chaincode-environment-variables.md": "deployment/chaincode-environment-variables",
"common-operation-script/substrate/decimals.md": "develop-business-logic/smart-contract-development/decimals",
"common-operation-script/substrate/defflow.md": "develop-business-logic/smart-contract-development/defflow",
"common-operation-script/substrate/elpspath.md": "develop-business-logic/smart-contract-development/ellipse-path",
"common-operation-script/substrate/substrate-indexes.md": "develop-business-logic/smart-contract-development/data-structures",
"common-operation-script/substrate/substrate-utilities.md": "develop-business-logic/smart-contract-development/common-utilities",
Expand All @@ -37,6 +38,7 @@
"connectors/connectorhub.md": "luther-connectors-setup/connector-hub",
"connectors/lutherauth/README.md": "luther-connectors-setup/application-module-configuration/lutherauth",
"connectors/lutherauth/behind-a-cdn.md": "luther-connectors-setup/application-module-configuration/lutherauth/behind-a-cdn",
"connectors/lutherauth/csrf.md": "luther-connectors-setup/application-module-configuration/lutherauth/csrf",
"connectors/lutherauth/network-access.md": "luther-connectors-setup/application-module-configuration/lutherauth/network-access",
"connectors/lutherauth/service-tokens.md": "luther-connectors-setup/application-module-configuration/lutherauth/service-tokens",
"connectors/lutherauth/sessions.md": "luther-connectors-setup/application-module-configuration/lutherauth/sessions",
Expand All @@ -46,6 +48,8 @@
"middleware/entity-update-guide.md": "luther-connectors-setup/api-update-guide",
"middleware/martin/README.md": "deployment/testing/martin-end-to-end-testing",
"middleware/martin/proxy.md": "deployment/testing/martin-proxy",
"operations/cloud-cost-optimization.md": "deployment/cloud-cost-optimization",
"operations/fabric-3-upgrade.md": "deployment/fabric-3-upgrade",
"operations/fabric-snapshot-archiver.md": "deployment/fabric-snapshot-archiver",
"operations/peer-storage.md": "deployment/peer-storage",
"release-notes.md": "deployment/release-notes",
Expand Down
42 changes: 27 additions & 15 deletions common-operation-script/ellipse-dev-language/function-reference.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
description: Every ELPS builtin, macro and library function in elps v1.95.0, from its docstring.
description: Every ELPS builtin, macro and library function in elps v1.98.0, from its docstring.
---

# Function Reference

<!-- Generated by scripts/elps-reference/generate.mjs from elps v1.95.0. Do not edit: change the docstring in luthersystems/elps, or the pin in wasm/elps/go.mod. -->
<!-- Generated by scripts/elps-reference/generate.mjs from elps v1.98.0. Do not edit: change the docstring in luthersystems/elps, or the pin in wasm/elps/go.mod. -->

This page lists every function, macro, special operator and variable of ELPS v1.95.0, the release the examples on this site run. It is generated from the docstrings in [luthersystems/elps](https://github.com/luthersystems/elps/tree/v1.95.0), the same text `elps doc <name>` prints. For examples and guidance, see the [Standard Library](standard-library.md) and the [Language Guide](language-guide.md).
This page lists every function, macro, special operator and variable of ELPS v1.98.0, the release the examples on this site run. It is generated from the docstrings in [luthersystems/elps](https://github.com/luthersystems/elps/tree/v1.98.0), the same text `elps doc <name>` prints. For examples and guidance, see the [Standard Library](standard-library.md) and the [Language Guide](language-guide.md).

Functions of the `lisp` package need no prefix. Call a function of another package with its package name, such as `string:join`.

Expand Down Expand Up @@ -56,7 +56,7 @@ Paths are given as positional ELPS values — one argument per path step, no str

? reads without copying. ?set, ?del and ?nil copy the document's maps, lists and vectors; their "!" forms mutate in place. In-place edits of list elements are refused; use a copying form or a vector instead. An out-of-range integer index leaves the document unchanged on a write (and returns nil on a read). Negative indexes count from the end.

Tagged values and quote wrappers are rebuilt recursively by copying writes and traversed by cycle checks, but cannot be indexed into. Other value types are opaque leaves, including symbols, bytes, functions and natives. Reads may return them and writes may store them. A further path step into a leaf raises an error naming its type and location. Copies share opaque leaves by reference; mutation of their storage outside elpspath is visible through both documents. Containers must be acyclic, and arrays must have exactly one dimension; every operation checks this throughout the document, including off-path containers and the contents of tagged values and quote wrappers. New values pass the same container check. Function bodies and captured environments remain opaque and shared; they are not walked.
Tagged values and quote wrappers are rebuilt recursively by copying writes and traversed by cycle checks, but cannot be indexed into. Other value types are opaque leaves, including symbols, bytes, functions and natives. Reads may return them and writes may store them. A further path step into a leaf raises an error naming its type and location. Copies share opaque leaves by reference; mutation of their storage outside elpspath is visible through both documents. Writes need containers that are acyclic and arrays with exactly one dimension, and check this throughout the document, including off-path containers and the contents of tagged values and quote wrappers, because a write may copy or rebuild any of them. New values pass the same check. A read (?) with a path checks only what that path steps into: it never walks beyond its path or into the value it returns, so a fault elsewhere cannot change its answer, and its cost follows the path rather than the document. A read with no path checks the whole document, as writes do. Function bodies and captured environments remain opaque and shared; they are not walked.

An iterator retains its per-element error handling: reads substitute nil for a failed element path, and writes leave that element unchanged.

Expand Down Expand Up @@ -106,7 +106,9 @@ Delete value at a path specified by positional args, mutating the original.

Out-of-range integer indexes are no-ops. List element mutation is refused.

(?del! obj "foo") =&gt; obj with foo removed (mutated) (?del! obj "items" 1) =&gt; obj with items\[1\] removed (mutated) (?del! records '\* "cache") =&gt; remove cache key from all elements
(?del! obj "foo") =&gt; obj with foo removed (mutated) (?del! obj "items" 1) =&gt; obj with items\[1\] removed (mutated) (?del! records '\* "cache") =&gt; remove cache key from all elements (?del! scores '\*) =&gt; every element of scores is nil

A path that ends in '\* stores nil in each element and keeps the length, as ?del does. The sequence must be a vector.

Accepts at most 1024 nested iterator steps; deeper traversal raises a depth error.

Expand All @@ -132,7 +134,9 @@ Set value at a path to nil, mutating the original. The key is kept.

Out-of-range integer indexes are no-ops. List element mutation is refused.

(?nil! obj "foo") =&gt; obj with foo=nil (mutated) (?nil! rows '\* "cached") =&gt; nil out cached on all elements
(?nil! obj "foo") =&gt; obj with foo=nil (mutated) (?nil! rows '\* "cached") =&gt; nil out cached on all elements (?nil! scores '\*) =&gt; every element of scores is nil

A path that ends in '\* stores nil in each element. The sequence must be a vector.

Accepts at most 1024 nested iterator steps; deeper traversal raises a depth error.

Expand Down Expand Up @@ -162,7 +166,9 @@ The last argument is the new value; all preceding arguments are path steps. Retu

The new value is stored BY REFERENCE, not copied: after the call it is reachable and mutable through the result, and a later write through either name is visible through the other.

(?set! obj "foo" "bar" "new") =&gt; obj with foo.bar="new" (mutated) (?set! obj "items" 0 "x") =&gt; obj with items\[0\]="x" (mutated) (?set! data '\* "active" true) =&gt; set active=true on all elements
(?set! obj "foo" "bar" "new") =&gt; obj with foo.bar="new" (mutated) (?set! obj "items" 0 "x") =&gt; obj with items\[0\]="x" (mutated) (?set! data '\* "active" true) =&gt; set active=true on all elements (?set! scores '\* 0) =&gt; every element of scores is 0

A path that ends in '\* stores the value in each element. The sequence must be a vector.

Accepts at most 1024 nested iterator steps; deeper traversal raises a depth error.

Expand Down Expand Up @@ -203,7 +209,7 @@ A selector may not SPAN LINES, and that raises for the same reason:

The jq-string grammar this shares cuts a bracket-led selector at its first newline and DISCARDS the rest, which would convert the selector above to the single step 0 -- a live path to the whole element. (apply ?set ...) through it would overwrite the record instead of its "password" field, silently.

Converting on each call is slower than one string-path operation, since it parses AND builds a list. How much the caching is worth depends on document size -- every operation first walks the whole document to validate it, so on a large document the parse is noise and on a small one it dominates.
Converting on each call is slower than one string-path operation, since it parses AND builds a list. How much the caching is worth depends on the operation: a write first walks the whole document to validate it, so on a large document the parse is noise, but a read (?) walks only its path, so for reads the parse can dominate at any document size.

## <a id="package-golang"></a>`golang`

Expand Down Expand Up @@ -833,9 +839,9 @@ Returns the value associated with key in a sorted-map, or nil if the key is not

### `get-default`

*macro*: `(get-default map key default)`
*operator*: `(get-default map key default)`

Looks up key in a sorted-map, returning the associated value if found. If the key is not present or map is nil, evaluates and returns default. String and symbol keys with the same name are interchangeable, including in JSON-decoded maps. The default expression is evaluated only when needed (lazy evaluation).
Looks up key in a sorted-map, returning the associated value if found. If the key is not present or map is nil, evaluates and returns default. String and symbol keys with the same name are interchangeable, including in JSON-decoded maps. The default expression is evaluated only when needed (lazy evaluation), in tail position. The map and key expressions are evaluated once each, in that order.

### `handler-bind`

Expand Down Expand Up @@ -977,9 +983,15 @@ Performs a single macro expansion step on quoted-form and returns the result. Us

### `macroexpand-all`

*function*: `(macroexpand-all quoted-form)`
*function*: `(macroexpand-all quoted-form &key lower)`

Expands every macro call in quoted-form, not just the head: the head is expanded until it is no longer a macro, then each nested form in code position is expanded the same way. Knows the binding shape of every special form, so a local variable or function that shadows a macro name is left alone, macrolet macros are expanded, and quoted data (quote, the non-unquoted parts of quasiquote, condition types) is never entered. defun and defmacro are kept as written with their bodies expanded. The input is not modified. Nesting deeper than the evaluator's nesting limit, or a head that keeps expanding past the macro expansion limit, is an error. With :lower true, get-default (today the only special operator with a lowering) is expanded as the macro it replaced expanded it, for tools that model the macro's expansion and not the operator.

### `macroexpand-all-lowered`

*function*: `(macroexpand-all-lowered quoted-form)`

Expands every macro call in quoted-form, not just the head: the head is expanded until it is no longer a macro, then each nested form in code position is expanded the same way. Knows the binding shape of every special form, so a local variable or function that shadows a macro name is left alone, macrolet macros are expanded, and quoted data (quote, the non-unquoted parts of quasiquote, condition types) is never entered. defun and defmacro are kept as written with their bodies expanded. The input is not modified. Nesting deeper than the evaluator's nesting limit, or a head that keeps expanding past the macro expansion limit, is an error.
Is (macroexpand-all quoted-form :lower true) with one argument, so a caller that counts evaluation steps pays the same as for macroexpand-all without :lower.

### `macrolet`

Expand Down Expand Up @@ -1263,7 +1275,7 @@ Converts value to a bytes value. Accepts strings (encoded as UTF-8) and bytes (r

*function*: `(to-float value)`

Converts value to a float. Accepts strings (parsed), floats (returned as-is), and integers (widened).
Converts value to a float. Accepts floats (returned as-is), integers (widened) and strings. A string must be a decimal number: an optional sign, digits with an optional point, and an optional exponent, as in "-12.75", ".5" or "1e5". The strings "nan", "inf" and "infinity", hexadecimal floats and digits separated by "\_" are errors, as is text with spaces. A number too large for a float is an error. A number too small for one converts to zero.

### `to-int`

Expand Down Expand Up @@ -1517,7 +1529,7 @@ Compiles a regular expression pattern string and returns a native regexp object.

*function*: `(regexp:regexp-match? re text)`

Returns true if the regexp matches text. re may be a compiled regexp or a pattern string (compiled on each call). text may be a string or bytes value.
Returns true if the regexp matches text. re may be a compiled regexp or a pattern string (compiled on each call). text may be a string or bytes value. A match costs one step for each KiB of text, times one plus the size of the compiled program in units of 256 instructions.

### `regexp:regexp-pattern`

Expand Down Expand Up @@ -2085,7 +2097,7 @@ Returns a new time value equal to datetime plus duration. The first argument mus

*function*: `(time:time-from start end)`

Returns the duration between start and end as a native duration value (end - start). Both arguments must be native time values. The result can be negative if end is before start.
Returns the duration between start and end as a native duration value (end - start). Both arguments must be native time values. The result can be negative if end is before start. A duration holds at most about 292 years in either direction. Returns an error if the difference is larger.

### `time:time<`

Expand Down
Loading
Loading