History

docs: document let, let* and letrec

Sigrid Solveig Haflínudóttir committed 4 months ago

Commit b9c4cc31 parent 0a9d6ff2 files · +69 −15Browse files

Unified · Split

2 files
  1. boot/sl.boot +18 −15
  2. src/system.sl +51 −0
boot/sl.boot+18−15
@@ -25,8 +25,9 @@ lead-pred))) io-pos! ((io · 24 unmodified lines
25new-position)) return (((value (void)))) tan ((r)) table (rest) __rcscript (NIL) doc-group ((group-name25new-position)) return (((value (void)))) tan ((r)) table (rest) __rcscript (NIL) doc-group ((group-name
26doc)) cdaaar ((lst)) bounds-error ((seq index . msg)) even? ((n)) zero? ((n)) proper-list? ((v)) random ((max26doc)) cdaaar ((lst)) bounds-error ((seq index . msg)) even? ((n)) zero? ((n)) proper-list? ((v)) random ((max
27(state NIL))) io-filename! ((io new-name)) reverse! ((lst)) eval ((x)) cdaadr ((lst)) u32 (((n27(state NIL))) io-filename! ((io new-name)) reverse! ((lst)) eval ((x)) cdaadr ((lst)) u32 (((n
280))) cons ((first second)) filter ((pred lst)) make-random-state (((state NIL))) assq ((key280))) cons ((first second)) filter ((pred lst)) assq ((key lst)) make-random-state (((state NIL))) let ((id
29lst)) io-buffer-mode! ((io)) del! ((table key)) when ((cond . body)) vec? ((v)) min ((v . rest)) cddaar ((lst)) num->str ((n29binds . body)
30(binds . body)) io-buffer-mode! ((io)) del! ((table key)) when ((cond . body)) vec? ((v)) min ((v . rest)) cddaar ((lst)) num->str ((n
30(:base 10))) io? ((term)) eof-object? ((v)) help (((topic 'help)31(:base 10))) io? ((term)) eof-object? ((v)) help (((topic 'help)
31(:print-header help-print-header) . rest)) mod ((a32(:print-header help-print-header) . rest)) mod ((a
32n)) if ((cond then . else)) p32 (((n 0))) io-read-lines ((io)) io-line ((io)) sym-set-doc ((symbol33n)) if ((cond then . else)) p32 (((n 0))) io-read-lines ((io)) io-line ((io)) sym-set-doc ((symbol
@@ -45,7 +46,7 @@ new-column-number)) copy-list ((lst (n NIL))) logand (ints) time-now (NIL) s · 12 unmodified lines
45lst)) io-pos ((io)) map-int ((fn count)) table->assoc-list ((ta)) length< ((seq n)) unless ((cond . body)) str->time ((str)) get-syntax ((sym)) ptr? ((v)) expt ((x46lst)) io-pos ((io)) map-int ((fn count)) table->assoc-list ((ta)) length< ((seq n)) unless ((cond . body)) str->time ((str)) get-syntax ((sym)) ptr? ((v)) expt ((x
46p)) io-read-all ((io)) gc (NIL) io-write ((io v (endian +endianness+))) table-invert ((ta)) lz-unpack ((data47p)) io-read-all ((io)) gc (NIL) io-write ((io v (endian +endianness+))) table-invert ((ta)) lz-unpack ((data
47:to destination)48:to destination)
48(data :size decompressed-bytes)) div ((a n)) princ (args) last-cdr ((lst)) trace ((sym)) io-filename ((io)) gensym? ((v)) defdoc ((term . doc)) cdddr ((lst)) copy-table ((ta)) set-car! ((cell49(data :size decompressed-bytes)) div ((a n)) princ (args) last-cdr ((lst)) trace ((sym)) io-filename ((io)) let* ((binds . body)) gensym? ((v)) defdoc ((term . doc)) cdddr ((lst)) copy-table ((ta)) set-car! ((cell
49new-first)) partition ((pred lst)) has? ((table key)) vec (rest) while ((cond . body)) rune (((n50new-first)) partition ((pred lst)) has? ((table key)) vec (rest) while ((cond . body)) rune (((n
5065533))) cadar ((lst)) type-error ((expected-type got-value . msg)) file ((path (mode 420) (:read5165533))) cadar ((lst)) type-error ((expected-type got-value . msg)) file ((path (mode 420) (:read
51NIL)52NIL)
@@ -64,7 +65,7 @@ lst)) bignum (((n 0))) copy-vec ((vec)) eqv? ((a b)) list (rest) __init_glo · 12 unmodified lines
64tail)) quote ((expr)) nreconc ((lst tail)) defc*r ((name)) read-all-of ((fn io)) cddddr ((lst)) prog1 ((expr . rest)) logior (ints) cadr ((lst)) cdadr ((lst)) nan? ((v)) caar ((lst)) div0 ((a65tail)) quote ((expr)) nreconc ((lst tail)) defc*r ((name)) read-all-of ((fn io)) cddddr ((lst)) prog1 ((expr . rest)) logior (ints) cadr ((lst)) cdadr ((lst)) nan? ((v)) caar ((lst)) div0 ((a
65n)) set-syntax! ((sym fn)) mod0 ((a n)) last-pair ((lst)) path-cwd (((to NIL))) arr? ((v)) cadaar ((lst)) unwind-protect ((expr66n)) set-syntax! ((sym fn)) mod0 ((a n)) last-pair ((lst)) path-cwd (((to NIL))) arr? ((v)) cadaar ((lst)) unwind-protect ((expr
66finally)) cos ((r)) io-skip ((io offset (:end NIL))) every ((pred lst)) atom? ((v)) p64 (((n67finally)) cos ((r)) io-skip ((io offset (:end NIL))) every ((pred lst)) atom? ((v)) p64 (((n
670))) str-utf8? ((s)) apply ((f arg . rest)) cddr ((lst)) not ((v)) print (args) cdar ((lst)) cdaar ((lst)) iota ((count680))) str-utf8? ((s)) apply ((f arg . rest)) cddr ((lst)) not ((v)) print (args) letrec ((binds . body)) cdar ((lst)) cdaar ((lst)) iota ((count
68(start 0) (step 1))) caaddr ((lst)) environment (NIL) getprop ((symbol key (def NIL))) putprop ((symbol69(start 0) (step 1))) caaddr ((lst)) environment (NIL) getprop ((symbol key (def NIL))) putprop ((symbol
69key val)) * (rest) repl (NIL) io-read-until ((io r)) get ((table key (failed-result))) table? ((v)) u16 (((n70key val)) * (rest) repl (NIL) io-read-until ((io r)) get ((table key (failed-result))) table? ((v)) u16 (((n
700))) logxor (ints) str-width ((s)) acos ((x)) time->str ((sec)) caddr ((lst)) to-proper ((lst)) table-keys ((ta)) catch ((tag710))) logxor (ints) str-width ((s)) acos ((x)) time->str ((sec)) caddr ((lst)) to-proper ((lst)) table-keys ((ta)) catch ((tag
@@ -78,20 +79,20 @@ lst)) max ((v . rest)) closure? ((v)) read-all ((io)) help-print-header ((te · 7 unmodified lines
78group error) "Errors and exception handling." io-eof? "Return `T` if `io` is currently in the \"end of file\" state, `NIL`\notherwise." path-exists? "Return `T` if `path` exists on the filesystem, `NIL` otherwise." cadddr "Shorthand for (car (cdr (cdr (cdr lst))))." (doc79group error) "Errors and exception handling." io-eof? "Return `T` if `io` is currently in the \"end of file\" state, `NIL`\notherwise." path-exists? "Return `T` if `path` exists on the filesystem, `NIL` otherwise." cadddr "Shorthand for (car (cdr (cdr (cdr lst))))." (doc
79group string) "Strings and runes." sort "Return a copy of the list sorted by comparing elements with the\ntwo-argument function `less-than?`.\n\nAn optional keyworded argument `:key` is used to provide a function to\nretrieve terms (the _key_) from the list items in order to perform\ncomparison. By default the terms compared are the list elements\nthemselves.\n\nExamples:\n\n ; simple sort (note: symbols > numbers)\n (sort '(1a 1 0 2b e 3) <)\n ; ↳ (0 1 3 1a 2b e)\n\n ; sort in lexicographical order (as strings)\n (sort '(1a 1 0 2b e 3) < :key str)\n ; ↳ (0 1 1a 2b 3 e)\n\n ; sort by type (note how the numbers stayed in the same order)\n (sort '(3 \"a\" 1 a #\\a 2)\n (λ (a b) (< (type-of a) (type-of b))))\n ; ↳ (3 1 2 #\\a \"a\" a)" fixnum? "Return `T` if `v` is of a fixnum type, `NIL` otherwise." exit "Terminate the process with the specified status. Does not return.\nThe status is expected to be a string in case of an error.\n\nExamples:\n\n (exit) ; exit with status 0 (nil on Plan 9)\n (exit \"error\") ; exit with status 1 (\"error\" on Plan 9)" __finish "A function called right before exit by the VM.\n\nThe exit `status` is either `NIL` or a string referring to an error\ncondition." caaar "Shorthand for (car (car (car lst)))." s32 "Construct a 32-bit signed number." u8 "Construct a 8-bit unsigned number." any "Return `T` if the predicate is true for _any_ element of the list,\n`NIL` otherwise.\n\nExample:\n\n ; is there any even number?\n (any even? '(1 3 5 7))\n ; ↳ NIL\n\n ; is there any string longer than one rune?\n (any (λ (s) (length> s 1))\n '(\"ab\" \"cd\" \"e\"))\n ; ↳ T" nthcdr "Return the reminder of the list after at most `n` elements, or `NIL`\nif the list is shorter.\n\nExamples:\n\n (def l '(a b c))\n (nthcdr l 1)\n ; ↳ (b c)\n (nthcdr l 2)\n ; ↳ (c)\n (nthcdr l 10)\n ; ↳ NIL" os-getenv "Return the value of the environment variable `name` or `NIL` if it's\nnot set." s8 "Construct a 8-bit signed number." io-close "Close the IO object.\n\nNo further operations on the IO object are possible, those will throw\nan exception if attempted. The only exception is `(io-filename io)`,\nwhich might be useful in some cases for debugging purposes.\n\nExamples:\n\n (def f (file \"/dev/random\"))\n (io-read f 'u8)\n ; ↳ #u8(123)\n (io-close f)\n (io-read f 'u8)\n ; ‼ I/O error: closed file" io-line! "Change the current line number of the IO object." num? "Return `T` if `v` is of a numerical type, `NIL` otherwise.\n\nNumerical types include floating point, fixnum, bignum, etc.\nNote: ironically, a NaN value is considered a number by this function\nsince it's only testing the _type_ of the value." +os-name+ "The name of the operating system this StreetLISP VM executable was\nbuilt for.\n\nIt's set to a lowercase string and its value is considered \"best\neffort\" - it might not always be accurate.\n\nPossible values: `\"unknown\"`, `\"plan9\"`, `\"linux\"`, `\"openbsd\"`,\n`\"netbsd\"`, `\"dragonflybsd\"`, `\"freebsd\"`, `\"haiku\"`, `\"macosx\"`,\n`\"macos\"`, `\"dos\"`." assert "Throw an exception if `expr` evaluates to `NIL`. Return `T` in any\nother case.\n\nExamples:\n\n (def s \"abc\")\n (assert (= (length s) 3))\n ; ↳ T\n (assert (eq? (str-rune s 0) #\\x))\n ; ‼ assertion failed: ..." vec->list "Return the vector converted to a list.\n\nExamples:\n\n (vec->list #(1 2 a))\n ; ↳ (1 2 a)" 1+ "Equivalent to `(+ n 1)` - increment by one." throw "Raise an exception consisting of a tag and a value.\n\nThis exception can be caught by `catch`." positive? "Return `T` if `n` is greater than zero. Shorthand for `(> n 0)`." atan "Return the arc tangent of `y/x` in radians." *builtins* "VM instructions as closures." remprop "Remove a property value associated with the symbol." io-copy-until "Copy bytes from the source IO object to the destination until\nencountering the delimiting rune `r` and return the number of bytes\ncopied. The copied bytes include the delimiter." (doc80group string) "Strings and runes." sort "Return a copy of the list sorted by comparing elements with the\ntwo-argument function `less-than?`.\n\nAn optional keyworded argument `:key` is used to provide a function to\nretrieve terms (the _key_) from the list items in order to perform\ncomparison. By default the terms compared are the list elements\nthemselves.\n\nExamples:\n\n ; simple sort (note: symbols > numbers)\n (sort '(1a 1 0 2b e 3) <)\n ; ↳ (0 1 3 1a 2b e)\n\n ; sort in lexicographical order (as strings)\n (sort '(1a 1 0 2b e 3) < :key str)\n ; ↳ (0 1 1a 2b 3 e)\n\n ; sort by type (note how the numbers stayed in the same order)\n (sort '(3 \"a\" 1 a #\\a 2)\n (λ (a b) (< (type-of a) (type-of b))))\n ; ↳ (3 1 2 #\\a \"a\" a)" fixnum? "Return `T` if `v` is of a fixnum type, `NIL` otherwise." exit "Terminate the process with the specified status. Does not return.\nThe status is expected to be a string in case of an error.\n\nExamples:\n\n (exit) ; exit with status 0 (nil on Plan 9)\n (exit \"error\") ; exit with status 1 (\"error\" on Plan 9)" __finish "A function called right before exit by the VM.\n\nThe exit `status` is either `NIL` or a string referring to an error\ncondition." caaar "Shorthand for (car (car (car lst)))." s32 "Construct a 32-bit signed number." u8 "Construct a 8-bit unsigned number." any "Return `T` if the predicate is true for _any_ element of the list,\n`NIL` otherwise.\n\nExample:\n\n ; is there any even number?\n (any even? '(1 3 5 7))\n ; ↳ NIL\n\n ; is there any string longer than one rune?\n (any (λ (s) (length> s 1))\n '(\"ab\" \"cd\" \"e\"))\n ; ↳ T" nthcdr "Return the reminder of the list after at most `n` elements, or `NIL`\nif the list is shorter.\n\nExamples:\n\n (def l '(a b c))\n (nthcdr l 1)\n ; ↳ (b c)\n (nthcdr l 2)\n ; ↳ (c)\n (nthcdr l 10)\n ; ↳ NIL" os-getenv "Return the value of the environment variable `name` or `NIL` if it's\nnot set." s8 "Construct a 8-bit signed number." io-close "Close the IO object.\n\nNo further operations on the IO object are possible, those will throw\nan exception if attempted. The only exception is `(io-filename io)`,\nwhich might be useful in some cases for debugging purposes.\n\nExamples:\n\n (def f (file \"/dev/random\"))\n (io-read f 'u8)\n ; ↳ #u8(123)\n (io-close f)\n (io-read f 'u8)\n ; ‼ I/O error: closed file" io-line! "Change the current line number of the IO object." num? "Return `T` if `v` is of a numerical type, `NIL` otherwise.\n\nNumerical types include floating point, fixnum, bignum, etc.\nNote: ironically, a NaN value is considered a number by this function\nsince it's only testing the _type_ of the value." +os-name+ "The name of the operating system this StreetLISP VM executable was\nbuilt for.\n\nIt's set to a lowercase string and its value is considered \"best\neffort\" - it might not always be accurate.\n\nPossible values: `\"unknown\"`, `\"plan9\"`, `\"linux\"`, `\"openbsd\"`,\n`\"netbsd\"`, `\"dragonflybsd\"`, `\"freebsd\"`, `\"haiku\"`, `\"macosx\"`,\n`\"macos\"`, `\"dos\"`." assert "Throw an exception if `expr` evaluates to `NIL`. Return `T` in any\nother case.\n\nExamples:\n\n (def s \"abc\")\n (assert (= (length s) 3))\n ; ↳ T\n (assert (eq? (str-rune s 0) #\\x))\n ; ‼ assertion failed: ..." vec->list "Return the vector converted to a list.\n\nExamples:\n\n (vec->list #(1 2 a))\n ; ↳ (1 2 a)" 1+ "Equivalent to `(+ n 1)` - increment by one." throw "Raise an exception consisting of a tag and a value.\n\nThis exception can be caught by `catch`." positive? "Return `T` if `n` is greater than zero. Shorthand for `(> n 0)`." atan "Return the arc tangent of `y/x` in radians." *builtins* "VM instructions as closures." remprop "Remove a property value associated with the symbol." io-copy-until "Copy bytes from the source IO object to the destination until\nencountering the delimiting rune `r` and return the number of bytes\ncopied. The copied bytes include the delimiter." (doc
80group list) "Working with lists." delete-file "Delete the file from the filesystem.\n\nThrows an IO error if file does not exist or it failed to be deleted." (doc81group list) "Working with lists." delete-file "Delete the file from the filesystem.\n\nThrows an IO error if file does not exist or it failed to be deleted." (doc
81group compare) "Comparison operators." cdddar "Shorthand for (cdr (cdr (cdr (car lst))))." set-cdr! "Modify a cons cell (a list) in-place by putting `new-second` as its\nsecond element (tail of the list). Return the modified cons\ncell (list).\n\nExamples:\n\n (def q '(1 2 3 4 5))\n (set-cdr! q '(6 7))\n ; ↳ (1 6 7)\n q\n ; ↳ (1 6 7)" stacktrace "Return the current stack trace." eq? "Return `T` if `a` and `b` are the same object, `NIL` otherwise.\n\nExamples:\n\n (eq? 0.0 0)\n ; ↳ NIL\n\n (eq? 0 0)\n ; ↳ T\n\n (def a \"1\")\n (def b \"1\")\n (eq? a b)\n ; ↳ NIL\n\n (def a '(1))\n (def b '(1))\n (eq? a b)\n ; ↳ NIL" *random-state* "The random state of the current process.\n\nThe state isn't set (is `NIL`) until a call is made to any function\nthat uses it." io->str "Return the data of the in-memory `io` buffer as a string." bound? "Return `T` if `sym` has a value associated with it, `NIL` otherwise.\n\nExamples:\n\n (bound? 'bound?)\n ; ↳ T\n\n (bound? 'doesnotcompute)\n ; ↳ NIL" list->vec "Return the list converted to a vector.\n\nExamples:\n\n (list->vec '(1 2 a))\n ; ↳ #(1 2 a)" odd? "Return `T` if `n` is an odd integer, `NIL` otherwise." def "Assign the function (first form) or the result of the expression\n(second form) to the identifier.\n\nDocumentation for the definition may also be supplied after `form` in\nthe same manner as with `defdoc`.\n\nFunction definitions themselves may contain other definitions internal\nto the function.\n\nExamples:\n\n ; a function with documentation (first form)\n (def (f x)\n \"Return the square of doubled `x`.\n\n Examples:\n\n (f 3)\n ; ↳ 36\"\n :doc-group cool-funcs ; documentation group for (help groups)\n :doc-see g ; reference another function in the documentation\n (def (g y) ; an internal function\n (+ y y))\n (* (g x) (g x)))\n (f 2)\n ; ↳ 16\n\n ; a variable (second form)\n (def x (length \"hello\"))\n x\n ; ↳ 5" list? "Return `T` if the value is either `NIL` or a cons cell, `NIL`\notherwise." str-rep "Return the concatenation of the `term` formatted as a string, repeated\n`k` times.\n\nExamples:\n\n (str-rep \"oi\" 3)\n ; ↳ \"oioioi\"\n\n (str-rep #\\ы 5)\n ; ↳ \"ыыыыы\"\n\n (str-rep 'a 3)\n ; ↳ \"aaa\"\n\n (str-rep 1 5)\n ; ↳ \"11111\"" time "Display the elapsed time of evaluating `expr` to `*io-out*`, return\nthe result of the evaluated expression.\n\nExamples:\n\n (time (begin (sleep 0.1) 12345))\n ; ‼ Elapsed time: 0.10013356 seconds\n ; ↳ 12345" size-of "Return the size of the value in bytes, if applicable.\n\nWorks only with C integer types, arrays, strings and in-memory\nbuffers.\n\nExamples:\n\n (size-of \"hello\")\n ; ↳ 5\n\n (size-of (arr 'u32 1 2 3))\n ; ↳ 12\n\n (def b (buffer))\n (io-write b \"hello\")\n (size-of b)\n ; ↳ 5" sym "Return a symbol with the name being the concatenation of terms\nformatted as strings.\n\nThis is equivalent to `(sym (str …))`.\n\nExamples:\n\n (sym \"a\" 'b 1)\n ; ↳ ab1" tanh "Return the hyperbolic tangent of `x`." for "Call the function `f` with a single argument in a loop until the argument\nreaches `limit` or greater.\n\nThe argument is incremented by `1` after each call, with the initial value\nset to `start`.\n\nExamples:\n\n (for 0 2 (λ (i) (print i)))\n ; ‼ 01" begin "Evaluate the expressions in order and return the result of the last\nexpression.\n\nExamples:\n\n (if 1\n (begin (print 1)\n (newline)\n 'ignored\n 'done)\n (print 0)\n (newline)\n 'else)\n ; ‼ 1\n ; ↳ done" const? "Return `T` if the term refers to a constant, `NIL` otherwise.\n\nConstants cannot be modified with `set!`. Trying to do so will result\nin an exception.\n\nExamples:\n\n (const? 12345) ; a number\n ; ↳ T\n\n (const? 'const?) ; a function\n ; ↳ NIL\n\n (const? 'pi) ; a mathematical constant\n ; ↳ T" str-trim "Return the portion of the string with all leading runes satisfying\n`lead-pred` (and trailing runes satisfying `trail-pred`) removed.\n\nWithout predicates explicitly specified, `str-trim` will remove\nwhitespace from both sides of the string.\n\nPass `NIL` as the predicate to disable trimming on either side.\n\nExamples:\n\n (str-trim \" \\nhello\\t\\v\")\n ; ↳ \"hello\"\n\n (str-trim \" \\nhello\\t\\v\"\n (λ (r) (str-find \" \\v\" r)))\n ; ↳ \"\\nhello\\t\"\n\n (str-trim \"123abc!456def\"\n rune-numeric?\n rune-alphabetic?)\n ; ↳ \"abc!456\"" io-pos! "Change the current absolute position within the IO object in bytes,\nreturn the resulting position.\n\nExamples:\n\n (def f (buffer))\n (io-write f \"hello, world!\")\n (io-pos! f 64)\n ; ↳ 13\n (io-pos! f 7)\n ; ↳ 7\n (read f)\n ; ↳ world!" return "Return from the function with the specified value as the result.\n\nExamples:\n\n (def (f x) (when (not x)\n (return 0))\n (princ \"hi\")\n (newline)\n 1)\n (f 'a)\n ; ‼ hi\n ; ↳ 1\n (f NIL)\n ; ↳ 0" *stderr* "Standard error output IO stream." tan "Return the tangent of `r`, where `r` is given in radians." table "Construct a table from keys from the arguments.\n\nEvery two arguments are expected to be a key and a value associated\nwith that key.\n\nExamples:\n\n (table)\n ; ↳ #table()\n\n (table 'a 1 'b 2)\n ; ↳ #table(a 1 b 2)" __rcscript "Execute, if exists, the user's \"run commands\" file.\n\nThe file path is predefined and depends on the OS:\n\n * `$home/lib/slrc` on Plan 9\n * `$HOME/.slrc` on other operating systems\n\nIt is automatically loaded by StreetLISP when running in interactive\nmode. The user may wish to use this file to change the look of the\nprompt, load additional functionality they want to use without having\nto do the process manually each time, and so on." doc-group "Define documentation for a group." cdaaar "Shorthand for (cdr (car (car (car lst))))." bounds-error "Raise a bounds error exception." even? "Return `T` if `n` is an even integer, `NIL` otherwise." *properties* "All properties of symbols recorded with `putprop` are recorded in this\ntable." zero? "Return `T` if `n` is zero. Shorthand for `(= n 0)`." proper-list? "Return `T` is the value is a proper list. That is, a non-circular\nlist with the last element being `NIL`, as opposed to a dotted list.\n\nExamples:\n\n ; empty list\n (proper-list? NIL)\n ; ↳ T\n\n ; a list with one element\n (proper-list? '(1))\n ; ↳ T\n\n ; a pair, cdr of the cell is 2\n (proper-list? '(1 . 2))\n ; ↳ NIL\n\n ; on a circular list\n (proper-list? '#0=(1 . #0#))\n ; ↳ NIL" random "Return a random number in the range `[0, max]` (inclusive).\n\nThe result is either an integer or a floating point number, depending\non the type of the `max` argument, which has to be a positive number.\n\nOptional `state` can be specified, otherwise the random state of the\ncurrent process (`*random-state*`) is used. State will be modified\nin-place.\n\nExamples:\n\n (random 1)\n ; ↳ 1\n\n (random 10000000000000000000000000000000000)\n ; ↳ 5312781302474765749507273681609477\n\n (random 1.0)\n ; ↳ 0.69517" io-filename! "Change the filename of the IO object, return the new filename.\n\nChanging the filename does not cause any side effects. The filename\nis purely informative and does not necessarily reflect the actual\npath.\n\nExamples:\n\n (def f (buffer))\n (io-filename b)\n ; ↳ \"\"\n (io-filename! b \"new name\") ; change the filename\n ; ↳ \"new name\"\n (io-filename b)\n ; ↳ \"new name\"" *directory-separator* "OS-specific path separator.\n\nIt is preferred over hardcoded `\"/\"`, for portability." reverse! "Return the list with its elements in reverse order.\n\nThe original list may be modified by this function since it's a\ndestructive operation.\n\nExamples:\n\n (def a '(1 2 3))\n (reverse! a)\n ; ↳ (3 2 1)\n a\n ; ↳ (1) ; original list has been modified in-place" eval "Evaluate expression.\n\nExamples:\n\n (eval '(begin (set! x 1 y 2) (+ x y)))\n ; ↳ 3\n x\n ; ↳ 1\n y\n ; ↳ 2" cdaadr "Shorthand for (cdr (car (car (cdr lst))))." u32 "Construct a 32-bit unsigned number." cons "Return a cons cell containing two arguments.\n\nExamples:\n\n (cons 1 2)\n ; ↳ (1 . 2)\n\n (cons 1 '(2))\n ; ↳ (1 2)\n\n (cons 1 (cons 2 (cons 3 NIL)))\n ; ↳ (1 2 3)" filter "Return a copy of the list with only the elements of the original\nthat satisfy the predicate.\n\nExamples:\n\n (filter odd? '(0 1 2 3 4))\n ; ↳ (1 3)" make-random-state "Return a new random state.\n\nIf `state` is `NIL`, a copy of the random state of the current process\n(`*random-state*`) is returned. If `state` is `T`, the returned random\nstate is a new one that has been randomly initialized. If an already\nexisting random state is passed, the returned value is a copy of that\nstate." assq "Return a pair of a matching key and the associated value, or `NIL` if\nnone matched. Keys are compared using `eq?`." io-buffer-mode! "Changed the output buffering behavior of the writable IO, return the\napplied value.\n\nSee `io-buffer-mode` for supported modes." del! "Remove any existing mapping for `key` and return the table.\n\nExamples:\n\n (def t #table(a 1 b 2))\n (del! t 'c)\n ; ↳ #table(b 2 a 1)\n (del! t 'b)\n ; ↳ #table(a 1)\n t\n ; ↳ #table(a 1)" when "Shorthand for `(if cond body NIL)`.\n\nA non-empty body is required.\n\nExamples:\n\n (when (eq? cmd 'exit)\n (princ \"exiting!\")\n (newline)\n (exit))" vec? "Return `T` if `v` is a vector, `NIL` otherwise." min "Return the smallest among the arguments.\n\nExamples:\n\n (min 3 1 9 4)\n ; ↳ 1\n\n (min 'c 'h 'z 'a)\n ; ↳ a\n\n (min \"t\" \"g\" \"a\")\n ; ↳ \"a\"" cddaar "Shorthand for (cdr (cdr (car (car lst))))." num->str "Return the number formatted as a string.\n\nFloating point numbers can only be formatted in base 10. Bignums are\nsupported with bases 2, 4, 8, 10, 16 and 32. The rest of the\nnumerical types are valid for any base from 2 to 36.\n\nNote: unlike other LISP dialects, StreetLISP's base-32 encoding is\ndone according to RFC 4648.\n\nExamples:\n\n (num->str 65535 :base 16)\n ; ↳ \"FFFF\"\n\n (num->str (s8 -7))\n ; ↳ \"-7\"" io? "Return `T` if `term` is of `io` type, `NIL` otherwise." eof-object? "Return `T` if the argument is `#<eof>`, `NIL` otherwise.\n\nThis object is returned by I/O functions to signal end of file,\nwhere applicable." help "Display documentation for a specific term or group of terms, if\navailable.\n\nAn optional symbol `group` is used to query for documentation on a\ngroup instead of a single term. All available documentation groups\ncan be displayed with `(help groups)`.\n\nAsterisk can be added to the beginning and/or end of the term in order\nto list the matching terms defined in the current environment. This\ncan be useful to recall a function's name.\n\nRune `↳` followed by an object appearing in the documentation describes\nthe returned value. Rune `‼` follows by what is being written to the\noutput or by an error raised.\n\nExamples:\n\n (help str?) ; show documentation for str?\n (help groups) ; show documentation groups\n (help type group) ; list items for dealing with types\n (help group type) ; same as above\n (help str->*) ; find functions converting from strings\n (help *->str) ; find functions converting to strings\n (help *num*) ; find anything related to numbers" (doc82group compare) "Comparison operators." cdddar "Shorthand for (cdr (cdr (cdr (car lst))))." set-cdr! "Modify a cons cell (a list) in-place by putting `new-second` as its\nsecond element (tail of the list). Return the modified cons\ncell (list).\n\nExamples:\n\n (def q '(1 2 3 4 5))\n (set-cdr! q '(6 7))\n ; ↳ (1 6 7)\n q\n ; ↳ (1 6 7)" stacktrace "Return the current stack trace." eq? "Return `T` if `a` and `b` are the same object, `NIL` otherwise.\n\nExamples:\n\n (eq? 0.0 0)\n ; ↳ NIL\n\n (eq? 0 0)\n ; ↳ T\n\n (def a \"1\")\n (def b \"1\")\n (eq? a b)\n ; ↳ NIL\n\n (def a '(1))\n (def b '(1))\n (eq? a b)\n ; ↳ NIL" *random-state* "The random state of the current process.\n\nThe state isn't set (is `NIL`) until a call is made to any function\nthat uses it." io->str "Return the data of the in-memory `io` buffer as a string." bound? "Return `T` if `sym` has a value associated with it, `NIL` otherwise.\n\nExamples:\n\n (bound? 'bound?)\n ; ↳ T\n\n (bound? 'doesnotcompute)\n ; ↳ NIL" list->vec "Return the list converted to a vector.\n\nExamples:\n\n (list->vec '(1 2 a))\n ; ↳ #(1 2 a)" odd? "Return `T` if `n` is an odd integer, `NIL` otherwise." def "Assign the function (first form) or the result of the expression\n(second form) to the identifier.\n\nDocumentation for the definition may also be supplied after `form` in\nthe same manner as with `defdoc`.\n\nFunction definitions themselves may contain other definitions internal\nto the function.\n\nExamples:\n\n ; a function with documentation (first form)\n (def (f x)\n \"Return the square of doubled `x`.\n\n Examples:\n\n (f 3)\n ; ↳ 36\"\n :doc-group cool-funcs ; documentation group for (help groups)\n :doc-see g ; reference another function in the documentation\n (def (g y) ; an internal function\n (+ y y))\n (* (g x) (g x)))\n (f 2)\n ; ↳ 16\n\n ; a variable (second form)\n (def x (length \"hello\"))\n x\n ; ↳ 5" list? "Return `T` if the value is either `NIL` or a cons cell, `NIL`\notherwise." str-rep "Return the concatenation of the `term` formatted as a string, repeated\n`k` times.\n\nExamples:\n\n (str-rep \"oi\" 3)\n ; ↳ \"oioioi\"\n\n (str-rep #\\ы 5)\n ; ↳ \"ыыыыы\"\n\n (str-rep 'a 3)\n ; ↳ \"aaa\"\n\n (str-rep 1 5)\n ; ↳ \"11111\"" time "Display the elapsed time of evaluating `expr` to `*io-out*`, return\nthe result of the evaluated expression.\n\nExamples:\n\n (time (begin (sleep 0.1) 12345))\n ; ‼ Elapsed time: 0.10013356 seconds\n ; ↳ 12345" size-of "Return the size of the value in bytes, if applicable.\n\nWorks only with C integer types, arrays, strings and in-memory\nbuffers.\n\nExamples:\n\n (size-of \"hello\")\n ; ↳ 5\n\n (size-of (arr 'u32 1 2 3))\n ; ↳ 12\n\n (def b (buffer))\n (io-write b \"hello\")\n (size-of b)\n ; ↳ 5" sym "Return a symbol with the name being the concatenation of terms\nformatted as strings.\n\nThis is equivalent to `(sym (str …))`.\n\nExamples:\n\n (sym \"a\" 'b 1)\n ; ↳ ab1" tanh "Return the hyperbolic tangent of `x`." for "Call the function `f` with a single argument in a loop until the argument\nreaches `limit` or greater.\n\nThe argument is incremented by `1` after each call, with the initial value\nset to `start`.\n\nExamples:\n\n (for 0 2 (λ (i) (print i)))\n ; ‼ 01" begin "Evaluate the expressions in order and return the result of the last\nexpression.\n\nExamples:\n\n (if 1\n (begin (print 1)\n (newline)\n 'ignored\n 'done)\n (print 0)\n (newline)\n 'else)\n ; ‼ 1\n ; ↳ done" const? "Return `T` if the term refers to a constant, `NIL` otherwise.\n\nConstants cannot be modified with `set!`. Trying to do so will result\nin an exception.\n\nExamples:\n\n (const? 12345) ; a number\n ; ↳ T\n\n (const? 'const?) ; a function\n ; ↳ NIL\n\n (const? 'pi) ; a mathematical constant\n ; ↳ T" str-trim "Return the portion of the string with all leading runes satisfying\n`lead-pred` (and trailing runes satisfying `trail-pred`) removed.\n\nWithout predicates explicitly specified, `str-trim` will remove\nwhitespace from both sides of the string.\n\nPass `NIL` as the predicate to disable trimming on either side.\n\nExamples:\n\n (str-trim \" \\nhello\\t\\v\")\n ; ↳ \"hello\"\n\n (str-trim \" \\nhello\\t\\v\"\n (λ (r) (str-find \" \\v\" r)))\n ; ↳ \"\\nhello\\t\"\n\n (str-trim \"123abc!456def\"\n rune-numeric?\n rune-alphabetic?)\n ; ↳ \"abc!456\"" io-pos! "Change the current absolute position within the IO object in bytes,\nreturn the resulting position.\n\nExamples:\n\n (def f (buffer))\n (io-write f \"hello, world!\")\n (io-pos! f 64)\n ; ↳ 13\n (io-pos! f 7)\n ; ↳ 7\n (read f)\n ; ↳ world!" return "Return from the function with the specified value as the result.\n\nExamples:\n\n (def (f x) (when (not x)\n (return 0))\n (princ \"hi\")\n (newline)\n 1)\n (f 'a)\n ; ‼ hi\n ; ↳ 1\n (f NIL)\n ; ↳ 0" *stderr* "Standard error output IO stream." tan "Return the tangent of `r`, where `r` is given in radians." table "Construct a table from keys from the arguments.\n\nEvery two arguments are expected to be a key and a value associated\nwith that key.\n\nExamples:\n\n (table)\n ; ↳ #table()\n\n (table 'a 1 'b 2)\n ; ↳ #table(a 1 b 2)" __rcscript "Execute, if exists, the user's \"run commands\" file.\n\nThe file path is predefined and depends on the OS:\n\n * `$home/lib/slrc` on Plan 9\n * `$HOME/.slrc` on other operating systems\n\nIt is automatically loaded by StreetLISP when running in interactive\nmode. The user may wish to use this file to change the look of the\nprompt, load additional functionality they want to use without having\nto do the process manually each time, and so on." doc-group "Define documentation for a group." cdaaar "Shorthand for (cdr (car (car (car lst))))." bounds-error "Raise a bounds error exception." even? "Return `T` if `n` is an even integer, `NIL` otherwise." *properties* "All properties of symbols recorded with `putprop` are recorded in this\ntable." zero? "Return `T` if `n` is zero. Shorthand for `(= n 0)`." proper-list? "Return `T` is the value is a proper list. That is, a non-circular\nlist with the last element being `NIL`, as opposed to a dotted list.\n\nExamples:\n\n ; empty list\n (proper-list? NIL)\n ; ↳ T\n\n ; a list with one element\n (proper-list? '(1))\n ; ↳ T\n\n ; a pair, cdr of the cell is 2\n (proper-list? '(1 . 2))\n ; ↳ NIL\n\n ; on a circular list\n (proper-list? '#0=(1 . #0#))\n ; ↳ NIL" random "Return a random number in the range `[0, max]` (inclusive).\n\nThe result is either an integer or a floating point number, depending\non the type of the `max` argument, which has to be a positive number.\n\nOptional `state` can be specified, otherwise the random state of the\ncurrent process (`*random-state*`) is used. State will be modified\nin-place.\n\nExamples:\n\n (random 1)\n ; ↳ 1\n\n (random 10000000000000000000000000000000000)\n ; ↳ 5312781302474765749507273681609477\n\n (random 1.0)\n ; ↳ 0.69517" io-filename! "Change the filename of the IO object, return the new filename.\n\nChanging the filename does not cause any side effects. The filename\nis purely informative and does not necessarily reflect the actual\npath.\n\nExamples:\n\n (def f (buffer))\n (io-filename b)\n ; ↳ \"\"\n (io-filename! b \"new name\") ; change the filename\n ; ↳ \"new name\"\n (io-filename b)\n ; ↳ \"new name\"" *directory-separator* "OS-specific path separator.\n\nIt is preferred over hardcoded `\"/\"`, for portability." reverse! "Return the list with its elements in reverse order.\n\nThe original list may be modified by this function since it's a\ndestructive operation.\n\nExamples:\n\n (def a '(1 2 3))\n (reverse! a)\n ; ↳ (3 2 1)\n a\n ; ↳ (1) ; original list has been modified in-place" eval "Evaluate expression.\n\nExamples:\n\n (eval '(begin (set! x 1 y 2) (+ x y)))\n ; ↳ 3\n x\n ; ↳ 1\n y\n ; ↳ 2" cdaadr "Shorthand for (cdr (car (car (cdr lst))))." u32 "Construct a 32-bit unsigned number." cons "Return a cons cell containing two arguments.\n\nExamples:\n\n (cons 1 2)\n ; ↳ (1 . 2)\n\n (cons 1 '(2))\n ; ↳ (1 2)\n\n (cons 1 (cons 2 (cons 3 NIL)))\n ; ↳ (1 2 3)" filter "Return a copy of the list with only the elements of the original\nthat satisfy the predicate.\n\nExamples:\n\n (filter odd? '(0 1 2 3 4))\n ; ↳ (1 3)" make-random-state "Return a new random state.\n\nIf `state` is `NIL`, a copy of the random state of the current process\n(`*random-state*`) is returned. If `state` is `T`, the returned random\nstate is a new one that has been randomly initialized. If an already\nexisting random state is passed, the returned value is a copy of that\nstate." assq "Return a pair of a matching key and the associated value, or `NIL` if\nnone matched. Keys are compared using `eq?`." io-buffer-mode! "Changed the output buffering behavior of the writable IO, return the\napplied value.\n\nSee `io-buffer-mode` for supported modes." let "Bind variables and execute a series of expression that use\nthese bindings, return the result of the last expression.\n\nThe first form `(let id ((… ) …) …)`, which is called\n\"named let\", allows referencing the resulting lambda within\nthe expressions following the bindings to aid with recursive\ncalls.\n\nExamples:\n\n (let loop ((a (iota 3 1))) ; first form\n (when a\n (princ (car a))\n (loop (cdr a))))\n ; ‼ 123\n ; ↳ NIL\n\n (let ((a 123) (b 456)) ; second form\n (+ a b))\n ; ↳ 579" del! "Remove any existing mapping for `key` and return the table.\n\nExamples:\n\n (def t #table(a 1 b 2))\n (del! t 'c)\n ; ↳ #table(b 2 a 1)\n (del! t 'b)\n ; ↳ #table(a 1)\n t\n ; ↳ #table(a 1)" when "Shorthand for `(if cond body NIL)`.\n\nA non-empty body is required.\n\nExamples:\n\n (when (eq? cmd 'exit)\n (princ \"exiting!\")\n (newline)\n (exit))" vec? "Return `T` if `v` is a vector, `NIL` otherwise." min "Return the smallest among the arguments.\n\nExamples:\n\n (min 3 1 9 4)\n ; ↳ 1\n\n (min 'c 'h 'z 'a)\n ; ↳ a\n\n (min \"t\" \"g\" \"a\")\n ; ↳ \"a\"" cddaar "Shorthand for (cdr (cdr (car (car lst))))." num->str "Return the number formatted as a string.\n\nFloating point numbers can only be formatted in base 10. Bignums are\nsupported with bases 2, 4, 8, 10, 16 and 32. The rest of the\nnumerical types are valid for any base from 2 to 36.\n\nNote: unlike other LISP dialects, StreetLISP's base-32 encoding is\ndone according to RFC 4648.\n\nExamples:\n\n (num->str 65535 :base 16)\n ; ↳ \"FFFF\"\n\n (num->str (s8 -7))\n ; ↳ \"-7\"" io? "Return `T` if `term` is of `io` type, `NIL` otherwise." eof-object? "Return `T` if the argument is `#<eof>`, `NIL` otherwise.\n\nThis object is returned by I/O functions to signal end of file,\nwhere applicable." help "Display documentation for a specific term or group of terms, if\navailable.\n\nAn optional symbol `group` is used to query for documentation on a\ngroup instead of a single term. All available documentation groups\ncan be displayed with `(help groups)`.\n\nAsterisk can be added to the beginning and/or end of the term in order\nto list the matching terms defined in the current environment. This\ncan be useful to recall a function's name.\n\nRune `↳` followed by an object appearing in the documentation describes\nthe returned value. Rune `‼` follows by what is being written to the\noutput or by an error raised.\n\nExamples:\n\n (help str?) ; show documentation for str?\n (help groups) ; show documentation groups\n (help type group) ; list items for dealing with types\n (help group type) ; same as above\n (help str->*) ; find functions converting from strings\n (help *->str) ; find functions converting to strings\n (help *num*) ; find anything related to numbers" (doc
82group array) "Arrays and vectors." mod "Return the remainder of the Euclidean division `a/n`.\n\nExamples:\n\n (mod 10 3)\n ; ↳ 1\n\n (mod -10 3)\n ; ↳ 2\n\n (mod -10 -3)\n ; ↳ 2\n\n (mod 10 -3)\n ; ↳ 1" if "Return the result of `then` if `cond` evaluated as \"true\", `else`\notherwise.\n\nThe `else` is not optional unlike in many other LISP implementations.\nPrimary purpose is to spot errors involving wrong parenthesis\nplacement. Another reason is to force a certain code style.\n\nExamples:\n\n (def x '(1))\n (if x (begin (print \"yep!\") (newline) 'yes) 0)\n ; ‼ yep!\n ; ↳ yes\n (if (str? x) 1 (print \"nope!\") (newline) 'no)\n ; ‼ nope!\n ; ↳ no" p32 "Construct a 32-bit abstract pointer value." io-read-lines "Return a list of lines read from the IO object until it ran out of\ndata.\n\nThe file is split into lines by `#\\linefeed`. Each string will have\nthe character, except the last line if EOF has been reached\nbeforehand.\n\nExamples:\n\n ; read current process' segments on Plan 9\n (def seg (file (str \"/proc/\" (getpid) \"/segment\")))\n (io-read-lines seg)\n ; ↳ (\"Stack 1feff0000 1ffff0000 1\\n\"\n \"Text R 10000 70000 1\\n\"\n \"Data 70000 d0000 1\\n\"\n \"Bss d0000 1a0000 1\\n\"\n \"Bss 1fcff0000 1feff0000 1\\n\"\n \"Bss 1faff0000 1fcff0000 1\\n\")" io-line "Return the current line number of the IO object.\n\nLine number is purely informative and is only being automatically\nupdated with the files opened for reading. If the cursor position is\nchanged via `io-skip` or `io-pos!`, the behavior is undefined." sym-set-doc "Set the documentation for the symbol." macrocall? "Return the macro application function if `e` refers to a macro call,\n`NIL` otherwise.\n\nExamples:\n\n (macrocall? '(car NIL))\n ; ↳ NIL\n\n (macrocall? '(let ((x 1)) 2))\n ; ↳ #fn(...)" trycatch "Return the result of evaluation of the expression `try` or, if an\nexception has been thrown, the one-argument function `catch`.\n\nExamples:\n\n (trycatch (+ 1 2) (λ (e) e))\n ; ↳ 3\n (trycatch (+ 1 NIL) (λ (e) e))\n ; ↳ (type-error num NIL)" (doc83group array) "Arrays and vectors." mod "Return the remainder of the Euclidean division `a/n`.\n\nExamples:\n\n (mod 10 3)\n ; ↳ 1\n\n (mod -10 3)\n ; ↳ 2\n\n (mod -10 -3)\n ; ↳ 2\n\n (mod 10 -3)\n ; ↳ 1" if "Return the result of `then` if `cond` evaluated as \"true\", `else`\notherwise.\n\nThe `else` is not optional unlike in many other LISP implementations.\nPrimary purpose is to spot errors involving wrong parenthesis\nplacement. Another reason is to force a certain code style.\n\nExamples:\n\n (def x '(1))\n (if x (begin (print \"yep!\") (newline) 'yes) 0)\n ; ‼ yep!\n ; ↳ yes\n (if (str? x) 1 (print \"nope!\") (newline) 'no)\n ; ‼ nope!\n ; ↳ no" p32 "Construct a 32-bit abstract pointer value." io-read-lines "Return a list of lines read from the IO object until it ran out of\ndata.\n\nThe file is split into lines by `#\\linefeed`. Each string will have\nthe character, except the last line if EOF has been reached\nbeforehand.\n\nExamples:\n\n ; read current process' segments on Plan 9\n (def seg (file (str \"/proc/\" (getpid) \"/segment\")))\n (io-read-lines seg)\n ; ↳ (\"Stack 1feff0000 1ffff0000 1\\n\"\n \"Text R 10000 70000 1\\n\"\n \"Data 70000 d0000 1\\n\"\n \"Bss d0000 1a0000 1\\n\"\n \"Bss 1fcff0000 1feff0000 1\\n\"\n \"Bss 1faff0000 1fcff0000 1\\n\")" io-line "Return the current line number of the IO object.\n\nLine number is purely informative and is only being automatically\nupdated with the files opened for reading. If the cursor position is\nchanged via `io-skip` or `io-pos!`, the behavior is undefined." sym-set-doc "Set the documentation for the symbol." macrocall? "Return the macro application function if `e` refers to a macro call,\n`NIL` otherwise.\n\nExamples:\n\n (macrocall? '(car NIL))\n ; ↳ NIL\n\n (macrocall? '(let ((x 1)) 2))\n ; ↳ #fn(...)" trycatch "Return the result of evaluation of the expression `try` or, if an\nexception has been thrown, the one-argument function `catch`.\n\nExamples:\n\n (trycatch (+ 1 2) (λ (e) e))\n ; ↳ 3\n (trycatch (+ 1 NIL) (λ (e) e))\n ; ↳ (type-error num NIL)" (doc
83group builtin) "Built-in operators." iterate "Return the list of length `n` containing results of applying function\n`fn` to `zero`, 0 through `n` times.\n\nThe result is of form\n\n [zero (fn zero) (fn (fn zero)) (fn (fn (fn zero))) …]\n\nExamples:\n\n (iterate 1+ 5 3)\n ; ↳ (5 6 7)\n\n (iterate (λ (x) (* x x)) 2 5)\n ; ↳ (2 4 16 256 65536)\n\n (iterate (λ (s) (str-sub s 1)) \"hello\" 5)\n ; ↳ (\"hello\" \"ello\" \"llo\" \"lo\" \"o\")" *syntax-environment* "Table containing macro definitions.\n\nThe keys are macro names, the values are their application functions." builtin "Return the builtin associated with the symbol.\n\nThrows an exception if no such builtin exists.\n\nExamples:\n\n (builtin 'map)\n ; ↳ #fn(map)\n\n (builtin 'print)\n ; ‼ arguments error: builtin \"print\" not found" table-values "Return the list of all values of the table.\n\nExamples:\n\n (def t #table(a 1 b 2 c 1))\n (table-values t)\n ; ↳ (1 2 1)" macroexpand "Return a fully macro-expanded expression.\n\nExpansion will continue until no more macro calls are left.\n\nExamples:\n\n (let ((a 3) (b 4) (c 5))\n (macroexpand `(let* {[x ,a] [y ,b]} (+ x y ,c))))\n ; ↳ ((λ (x)\n ((λ (y)\n (+ x y 5))\n 4))\n 3)" caadr "Shorthand for (car (car (cdr lst)))." type-of "Return the underlying type of the value.\n\nExamples:\n\n (type-of 1)\n ; ↳ fixnum\n\n (type-of NIL)\n ; ↳ null\n\n (type-of T)\n ; ↳ bool\n\n (type-of \"hello\")\n ; ↳ str\n\n (type-of (arr 'u32 0 1 2))\n ; ↳ (arr u32)" top-level-value "Return the value bound to the symbol in the top level (global)\nenvironment.\n\nExamples:\n\n (def abc 1)\n (let {[abc 2]}\n (cons abc (top-level-value 'abc)))\n ; ↳ (2 . 1)\n abc\n ; ↳ 1" defstruct "Declare a new structure type with the specified name and slots.\n\nThe default underlying type is a \"named\" vector (`:type vec`), where\nthe first element is the name of the structure's type, the rest are\nthe keyworded slot values. A list with slot values alone can be used\ninstead by adding `:type list` option. The list will not contain the\nname of the struct by default, which can be enabled with `:named T`\noption.\n\nAs an example, the following declaration generates the default\nconstructor for a structure of three slots, with one of them (`c`)\nhaving a non-`NIL` default value and marked as read-only:\n\n (defstruct blah \"Return stuff.\" :doc-group stuff a b (c 1 :read-only T))\n ; (make-blah (:a NIL) (:b NIL) (:c 1))\n ; (blah-a s)\n ; (blah-b s)\n ; (blah-c s)\n ; (blah-a! s new-a)\n ; (blah-b! s new-b)\n\nSlot's options, if any, should be specified after its default value.\nSupported options are:\n\n ; mark the slot as read-only\n ; its value can be read, but trying to modify it will throw an error\n … :read-only T\n\nThe constructor can be changed in several ways:\n\n ; disable the constructor altogether\n (defstruct blah :constructor NIL a b c)\n ; only change its name\n (defstruct blah :constructor blargh a b c)\n ; rename AND avoid using keywords\n (defstruct blah :constructor (blah a b c) a b c)\n\nThe option `:conc-name` specifies the slot accessor/setter prefix,\nwhich defaults to `structname-`. Prefix can be disabled entirely with\n`:conc-name NIL`.\n\nSlot setters are generated for writable slots by appending `!`\n(exclamation mark) to the accessor's name.\n\nDefault predicate can be disabled or its name, which defaults to\n`structname?`, changed:\n\n ; use \"blargh?\" instead of \"blah?\"\n (defstruct blah :predicate blargh? a b c)\n ; without predicate\n (defstruct blah :predicate NIL a b c)" caadar "Shorthand for (car (car (cdr (car lst))))." foldl1 "Same as `foldl` but using the first element of the sequence as the\ninitial accumulator.\n\nExamples:\n\n (foldl1 * (iota 6 1))\n ; ↳ 720" buffer "Return an in-memory buffer for I/O, of `io` type.\n\nA buffer can be used for both reading and writing at the same\ntime." random-state? "Return `T` if the argument is a random state object, `NIL` otherwise.\n\nExamples:\n\n (random-state? 1)\n ; ↳ NIL\n\n (random-state? (make-random-state))\n ; ↳ T\n\n (random-state? *random-state*)\n ; ↳ T" assoc-list "Construct an association list from the arguments.\n\nEvery two arguments are expected to be a key and a value associated\nwith that key.\n\nExamples:\n\n (assoc-list 'a 0 'b 1)\n ; ↳ ((a . 0) (b . 1))" builtin? "Return `T` if `v` is a built-in function implemented in C, `NIL`\notherwise.\n\nExamples:\n\n (builtin? map)\n ; ↳ T\n\n (builtin? macroexpand)\n ; ↳ NIL" str-map "Return the concatenation of the values produced by `fn` when applying\nto each rune of the string `s`.\n\nFunction `fn` may return a value of any type suitable for `io-write` -\na rune, string, array of C primitives. If `fn` returns `NIL`, the\nrune is ignored.\n\nExamples:\n\n (str-map rune-upcase\n \"hello, world!\")\n ; ↳ \"HELLO, WORLD!\"\n\n (str-map (λ (r) (str r r))\n \"hello\")\n ; ↳ \"hheelllloo\"\n\n (str-map (λ (r) (and (not (rune-whitespace? r)) r))\n \"! this is great !\")\n ; ↳ \"!thisisgreat!\"" macroexpand-1 "Return a macro-expanded expression.\n\nIf the expression is not a macro call, it is returned unchanged.\nOnly a single level of expansion is performed.\n\nExamples:\n\n (let ((a 3) (b 4) (c 5))\n (macroexpand-1 `(let* {[x ,a] [y ,b]} (+ x y ,c))))\n ; ↳ ((λ (x) ; note how the inner let* expression isn't expanded\n (let* ((y 4)) (+ x y 5)))\n 3)" +endianness+ "Endianess of the CPU the VM is running on, a constant.\n\nSet to either `:big-endian` or `:little-endian`." remove-duplicates "Return a copy of the list with duplicated elements removed.\n\nElements are tested for duplicates using `equal?`. The order of the\nelements is preserved in the resulting list.\n\nExamples:\n\n (remove-duplicates '(a 0 b c1 a b 3 c 5))\n ; ↳ (a 0 b c1 3 c 5)" str "Return concatenation of terms formatted as strings.\n\nThis is equivalent to `(princ terms…)`, except the string is\n_returned_, rather than printed.\n\nExamples:\n\n (str \"a\" 'b 1 #(0))\n ; ↳ \"ab1#(0)\"" negative? "Return `T` if `n` is a negative number. Shorthand for `(< n 0)`." void "Return the constant `#<void>` while ignoring any arguments.\n\n`#<void>` is mainly used when a function has side effects but does not\nproduce any meaningful value to return, so even though `T` or `NIL` could\nbe returned instead, in case of `#<void>` alone, REPL will not print\nit." assert-fail "Throw an \"assertion failed\" exception if evaluating `expr` itself does\nnot result in an exception thrown. Return `T` otherwise.\n\nTo test for a specific exception type, an optional `what` argument can\nbe used.\n\nExamples:\n\n (def s \"abc\")\n (assert-fail (= (length s) 3))\n ; ‼ assertion failed: ...\n (assert-fail (= s 1) type-error)\n ; ↳ T" io-read-line "Return a single line of input read from `io`.\n\nReading stops at either a `#\\linefeed` character or upon reaching EOF.\nThe line feed character is included in the returned value unless EOF\nhas been reached beforehand.\n\nEOF (`#<eof-object>`) is returned if the IO object had no data.\n\nExamples:\n\n ; read one line from the kernel messages file\n (io-read-line (file \"/dev/kmesg\"))\n ; ↳ \"127 holes free\\n\"\n\n ; /dev/null has no data - EOF is returned\n (eof-object? (io-read-line (file \"/dev/null\")))\n ; ↳ T" and "Return `NIL` and stop evaluating the arguments if one of them\nevaluated to `NIL`. Return the last value otherwise.\n\nExamples:\n\n (and)\n ; ↳ T\n\n (and 1 2 (print 'yes) 3)\n ; ‼ yes\n ; ↳ 3\n\n (and 1 NIL (print 'yes) 3)\n ; ↳ NIL" 1- "Equivalent to `(- n 1)` - decrement by one." io-buffer-mode "Return the output buffering mode of the writable IO.\n\nPossible values include:\n\n* `NIL` - no buffering, data is written immediately\n* `:line` - data is written when `#\\newline` is encountered\n* `:block` - data is written when the buffer is full\n* `:memory` - the IO is an in-memory buffer itself" that "The result of the last expression evaluated in the REPL.\n\nExamples:\n\n (map rune-upcase \"hello, world!\")\n ; ↳ \"HELLO, WORLD!\"\n (str-sub that 0 5)\n ; ↳ \"HELLO\"\n (map rune-downcase that)\n ; ↳ \"hello\"" (doc84group builtin) "Built-in operators." iterate "Return the list of length `n` containing results of applying function\n`fn` to `zero`, 0 through `n` times.\n\nThe result is of form\n\n [zero (fn zero) (fn (fn zero)) (fn (fn (fn zero))) …]\n\nExamples:\n\n (iterate 1+ 5 3)\n ; ↳ (5 6 7)\n\n (iterate (λ (x) (* x x)) 2 5)\n ; ↳ (2 4 16 256 65536)\n\n (iterate (λ (s) (str-sub s 1)) \"hello\" 5)\n ; ↳ (\"hello\" \"ello\" \"llo\" \"lo\" \"o\")" *syntax-environment* "Table containing macro definitions.\n\nThe keys are macro names, the values are their application functions." builtin "Return the builtin associated with the symbol.\n\nThrows an exception if no such builtin exists.\n\nExamples:\n\n (builtin 'map)\n ; ↳ #fn(map)\n\n (builtin 'print)\n ; ‼ arguments error: builtin \"print\" not found" table-values "Return the list of all values of the table.\n\nExamples:\n\n (def t #table(a 1 b 2 c 1))\n (table-values t)\n ; ↳ (1 2 1)" macroexpand "Return a fully macro-expanded expression.\n\nExpansion will continue until no more macro calls are left.\n\nExamples:\n\n (let ((a 3) (b 4) (c 5))\n (macroexpand `(let* {[x ,a] [y ,b]} (+ x y ,c))))\n ; ↳ ((λ (x)\n ((λ (y)\n (+ x y 5))\n 4))\n 3)" caadr "Shorthand for (car (car (cdr lst)))." type-of "Return the underlying type of the value.\n\nExamples:\n\n (type-of 1)\n ; ↳ fixnum\n\n (type-of NIL)\n ; ↳ null\n\n (type-of T)\n ; ↳ bool\n\n (type-of \"hello\")\n ; ↳ str\n\n (type-of (arr 'u32 0 1 2))\n ; ↳ (arr u32)" top-level-value "Return the value bound to the symbol in the top level (global)\nenvironment.\n\nExamples:\n\n (def abc 1)\n (let {[abc 2]}\n (cons abc (top-level-value 'abc)))\n ; ↳ (2 . 1)\n abc\n ; ↳ 1" defstruct "Declare a new structure type with the specified name and slots.\n\nThe default underlying type is a \"named\" vector (`:type vec`), where\nthe first element is the name of the structure's type, the rest are\nthe keyworded slot values. A list with slot values alone can be used\ninstead by adding `:type list` option. The list will not contain the\nname of the struct by default, which can be enabled with `:named T`\noption.\n\nAs an example, the following declaration generates the default\nconstructor for a structure of three slots, with one of them (`c`)\nhaving a non-`NIL` default value and marked as read-only:\n\n (defstruct blah \"Return stuff.\" :doc-group stuff a b (c 1 :read-only T))\n ; (make-blah (:a NIL) (:b NIL) (:c 1))\n ; (blah-a s)\n ; (blah-b s)\n ; (blah-c s)\n ; (blah-a! s new-a)\n ; (blah-b! s new-b)\n\nSlot's options, if any, should be specified after its default value.\nSupported options are:\n\n ; mark the slot as read-only\n ; its value can be read, but trying to modify it will throw an error\n … :read-only T\n\nThe constructor can be changed in several ways:\n\n ; disable the constructor altogether\n (defstruct blah :constructor NIL a b c)\n ; only change its name\n (defstruct blah :constructor blargh a b c)\n ; rename AND avoid using keywords\n (defstruct blah :constructor (blah a b c) a b c)\n\nThe option `:conc-name` specifies the slot accessor/setter prefix,\nwhich defaults to `structname-`. Prefix can be disabled entirely with\n`:conc-name NIL`.\n\nSlot setters are generated for writable slots by appending `!`\n(exclamation mark) to the accessor's name.\n\nDefault predicate can be disabled or its name, which defaults to\n`structname?`, changed:\n\n ; use \"blargh?\" instead of \"blah?\"\n (defstruct blah :predicate blargh? a b c)\n ; without predicate\n (defstruct blah :predicate NIL a b c)" caadar "Shorthand for (car (car (cdr (car lst))))." foldl1 "Same as `foldl` but using the first element of the sequence as the\ninitial accumulator.\n\nExamples:\n\n (foldl1 * (iota 6 1))\n ; ↳ 720" buffer "Return an in-memory buffer for I/O, of `io` type.\n\nA buffer can be used for both reading and writing at the same\ntime." random-state? "Return `T` if the argument is a random state object, `NIL` otherwise.\n\nExamples:\n\n (random-state? 1)\n ; ↳ NIL\n\n (random-state? (make-random-state))\n ; ↳ T\n\n (random-state? *random-state*)\n ; ↳ T" assoc-list "Construct an association list from the arguments.\n\nEvery two arguments are expected to be a key and a value associated\nwith that key.\n\nExamples:\n\n (assoc-list 'a 0 'b 1)\n ; ↳ ((a . 0) (b . 1))" builtin? "Return `T` if `v` is a built-in function implemented in C, `NIL`\notherwise.\n\nExamples:\n\n (builtin? map)\n ; ↳ T\n\n (builtin? macroexpand)\n ; ↳ NIL" str-map "Return the concatenation of the values produced by `fn` when applying\nto each rune of the string `s`.\n\nFunction `fn` may return a value of any type suitable for `io-write` -\na rune, string, array of C primitives. If `fn` returns `NIL`, the\nrune is ignored.\n\nExamples:\n\n (str-map rune-upcase\n \"hello, world!\")\n ; ↳ \"HELLO, WORLD!\"\n\n (str-map (λ (r) (str r r))\n \"hello\")\n ; ↳ \"hheelllloo\"\n\n (str-map (λ (r) (and (not (rune-whitespace? r)) r))\n \"! this is great !\")\n ; ↳ \"!thisisgreat!\"" macroexpand-1 "Return a macro-expanded expression.\n\nIf the expression is not a macro call, it is returned unchanged.\nOnly a single level of expansion is performed.\n\nExamples:\n\n (let ((a 3) (b 4) (c 5))\n (macroexpand-1 `(let* {[x ,a] [y ,b]} (+ x y ,c))))\n ; ↳ ((λ (x) ; note how the inner let* expression isn't expanded\n (let* ((y 4)) (+ x y 5)))\n 3)" +endianness+ "Endianess of the CPU the VM is running on, a constant.\n\nSet to either `:big-endian` or `:little-endian`." remove-duplicates "Return a copy of the list with duplicated elements removed.\n\nElements are tested for duplicates using `equal?`. The order of the\nelements is preserved in the resulting list.\n\nExamples:\n\n (remove-duplicates '(a 0 b c1 a b 3 c 5))\n ; ↳ (a 0 b c1 3 c 5)" str "Return concatenation of terms formatted as strings.\n\nThis is equivalent to `(princ terms…)`, except the string is\n_returned_, rather than printed.\n\nExamples:\n\n (str \"a\" 'b 1 #(0))\n ; ↳ \"ab1#(0)\"" negative? "Return `T` if `n` is a negative number. Shorthand for `(< n 0)`." void "Return the constant `#<void>` while ignoring any arguments.\n\n`#<void>` is mainly used when a function has side effects but does not\nproduce any meaningful value to return, so even though `T` or `NIL` could\nbe returned instead, in case of `#<void>` alone, REPL will not print\nit." assert-fail "Throw an \"assertion failed\" exception if evaluating `expr` itself does\nnot result in an exception thrown. Return `T` otherwise.\n\nTo test for a specific exception type, an optional `what` argument can\nbe used.\n\nExamples:\n\n (def s \"abc\")\n (assert-fail (= (length s) 3))\n ; ‼ assertion failed: ...\n (assert-fail (= s 1) type-error)\n ; ↳ T" io-read-line "Return a single line of input read from `io`.\n\nReading stops at either a `#\\linefeed` character or upon reaching EOF.\nThe line feed character is included in the returned value unless EOF\nhas been reached beforehand.\n\nEOF (`#<eof-object>`) is returned if the IO object had no data.\n\nExamples:\n\n ; read one line from the kernel messages file\n (io-read-line (file \"/dev/kmesg\"))\n ; ↳ \"127 holes free\\n\"\n\n ; /dev/null has no data - EOF is returned\n (eof-object? (io-read-line (file \"/dev/null\")))\n ; ↳ T" and "Return `NIL` and stop evaluating the arguments if one of them\nevaluated to `NIL`. Return the last value otherwise.\n\nExamples:\n\n (and)\n ; ↳ T\n\n (and 1 2 (print 'yes) 3)\n ; ‼ yes\n ; ↳ 3\n\n (and 1 NIL (print 'yes) 3)\n ; ↳ NIL" 1- "Equivalent to `(- n 1)` - decrement by one." io-buffer-mode "Return the output buffering mode of the writable IO.\n\nPossible values include:\n\n* `NIL` - no buffering, data is written immediately\n* `:line` - data is written when `#\\newline` is encountered\n* `:block` - data is written when the buffer is full\n* `:memory` - the IO is an in-memory buffer itself" that "The result of the last expression evaluated in the REPL.\n\nExamples:\n\n (map rune-upcase \"hello, world!\")\n ; ↳ \"HELLO, WORLD!\"\n (str-sub that 0 5)\n ; ↳ \"HELLO\"\n (map rune-downcase that)\n ; ↳ \"hello\"" (doc
84group prop) "Dealing with properties of symbols." (doc group vm) "VM-related functions." equal? "Return `T` if both `a` and `b` are of the same value. For non-leaf\ntypes (cons cell and vector), the equality test is performed\nthroughout the whole structure of the values.\n\nExamples:\n\n (equal? 0.0 0)\n ; ↳ NIL\n\n (equal? 0 0)\n ; ↳ T\n\n (def a \"1\")\n (def b \"1\")\n (equal? a b)\n ; ↳ T\n\n (def a '(1))\n (def b '(1))\n (equal? a b)\n ; ↳ T" cddar "Shorthand for (cdr (cdr (car lst)))." *interactive* "Variable indicating whether VM is running in \"interactive\" mode (`T`,\nREPL is active) or not (`NIL`, REPL is not active).\n\nInteractive mode can be forced by adding `-i` as the first command\nline argument." unquote "Evaluate the expression, which is a part of a quasiquoted expression\nitself.\n\nShorthand for `(unquote expr)`.\n\nExamples:\n\n `(0 1 ,(+ 2 3)) ; same as (quasiquote (0 1 (unquote (+ 2 3))))\n ; ↳ (0 1 5)" or "Return the first evaluated argument that is not `NIL` and stop\nevaluating the rest of the arguments. Return `NIL` otherwise.\n\nExamples:\n\n (or)\n ; ↳ NIL\n\n (or 1 2 (print 'first) (print 'second) 3)\n ; ↳ 1\n\n (or NIL NIL (print 'first) (print 'second) 3)\n ; ‼ first" = "Numerical equality test. Return `T` if all numbers are equal,\n`NIL` otherwise." fn? "Return `T` if `v` is a function, `NIL` otherwise.\n\nExamples:\n\n (fn? (void))\n ; ↳ NIL\n\n (fn? map)\n ; ↳ T\n\n (fn? macroexpand)\n ; ↳ T" (doc85group prop) "Dealing with properties of symbols." (doc group vm) "VM-related functions." equal? "Return `T` if both `a` and `b` are of the same value. For non-leaf\ntypes (cons cell and vector), the equality test is performed\nthroughout the whole structure of the values.\n\nExamples:\n\n (equal? 0.0 0)\n ; ↳ NIL\n\n (equal? 0 0)\n ; ↳ T\n\n (def a \"1\")\n (def b \"1\")\n (equal? a b)\n ; ↳ T\n\n (def a '(1))\n (def b '(1))\n (equal? a b)\n ; ↳ T" cddar "Shorthand for (cdr (cdr (car lst)))." *interactive* "Variable indicating whether VM is running in \"interactive\" mode (`T`,\nREPL is active) or not (`NIL`, REPL is not active).\n\nInteractive mode can be forced by adding `-i` as the first command\nline argument." unquote "Evaluate the expression, which is a part of a quasiquoted expression\nitself.\n\nShorthand for `(unquote expr)`.\n\nExamples:\n\n `(0 1 ,(+ 2 3)) ; same as (quasiquote (0 1 (unquote (+ 2 3))))\n ; ↳ (0 1 5)" or "Return the first evaluated argument that is not `NIL` and stop\nevaluating the rest of the arguments. Return `NIL` otherwise.\n\nExamples:\n\n (or)\n ; ↳ NIL\n\n (or 1 2 (print 'first) (print 'second) 3)\n ; ↳ 1\n\n (or NIL NIL (print 'first) (print 'second) 3)\n ; ‼ first" = "Numerical equality test. Return `T` if all numbers are equal,\n`NIL` otherwise." fn? "Return `T` if `v` is a function, `NIL` otherwise.\n\nExamples:\n\n (fn? (void))\n ; ↳ NIL\n\n (fn? map)\n ; ↳ T\n\n (fn? macroexpand)\n ; ↳ T" (doc
85group type) "Dealing with types." caaadr "Shorthand for (car (car (car (cdr lst))))." make-system-image "Build and store a \"system image\" of the runtime environment to a file." subseq "Return a bounded part of a sequence.\n\nThe returned value is always a copy of the subsequence of the\noriginal. It is an error if either `start` or `end` (if specified)\nare out of bounds.\n\nExamples:\n\n (subseq \"hello\" 1 2)\n ; ↳ \"e\"\n\n (subseq '(1 2 3) 0 2)\n ; ↳ (1 2)\n\n (subseq #(a b c) 2)\n ; ↳ #(c)" set! "Evaluate the expression, assign the result to the identifier and\nreturn the value.\n\nThe identifier must already be bound in the same environment,\notherwise this results in a compilation error.\n\nMultiple identifiers and expressions may be specified in pairs. The\nreturned value will be the result of the last expression.\n\nExamples:\n\n (def a NIL)\n (def b NIL)\n (def c NIL)\n (set! a 1 b 2 c (+ a b))\n ; ↳ 3\n a\n ; ↳ 1\n b\n ; ↳ 2\n c\n ; ↳ 3" vm-stats "Print various VM-related information, such as the number of GC\ncalls so far, heap and stack size, etc." ptr "Construct an abstract pointer value. The bit width is either 32-bit\nor 64-bit, depending on the platform the code is executing on.\n\nNote: certain arithmetic operations on pointers, such as division and\nmultiplication, will throw an error. This is done on purpose since\ndoing that on pointers rarely makes sense." caddar "Shorthand for (car (cdr (cdr (car lst))))." print-stack-trace "Print the stacktrace." *stdin* "Standard input IO stream." cosh "Return the hyperbolic cosine of `x`." < "Return `T` if the arguments are in strictly increasing order (next\none is greater than the previous one). With a single argument\nthe result is always `T`." (doc86group type) "Dealing with types." caaadr "Shorthand for (car (car (car (cdr lst))))." make-system-image "Build and store a \"system image\" of the runtime environment to a file." subseq "Return a bounded part of a sequence.\n\nThe returned value is always a copy of the subsequence of the\noriginal. It is an error if either `start` or `end` (if specified)\nare out of bounds.\n\nExamples:\n\n (subseq \"hello\" 1 2)\n ; ↳ \"e\"\n\n (subseq '(1 2 3) 0 2)\n ; ↳ (1 2)\n\n (subseq #(a b c) 2)\n ; ↳ #(c)" set! "Evaluate the expression, assign the result to the identifier and\nreturn the value.\n\nThe identifier must already be bound in the same environment,\notherwise this results in a compilation error.\n\nMultiple identifiers and expressions may be specified in pairs. The\nreturned value will be the result of the last expression.\n\nExamples:\n\n (def a NIL)\n (def b NIL)\n (def c NIL)\n (set! a 1 b 2 c (+ a b))\n ; ↳ 3\n a\n ; ↳ 1\n b\n ; ↳ 2\n c\n ; ↳ 3" vm-stats "Print various VM-related information, such as the number of GC\ncalls so far, heap and stack size, etc." ptr "Construct an abstract pointer value. The bit width is either 32-bit\nor 64-bit, depending on the platform the code is executing on.\n\nNote: certain arithmetic operations on pointers, such as division and\nmultiplication, will throw an error. This is done on purpose since\ndoing that on pointers rarely makes sense." caddar "Shorthand for (car (cdr (cdr (car lst))))." print-stack-trace "Print the stacktrace." *stdin* "Standard input IO stream." cosh "Return the hyperbolic cosine of `x`." < "Return `T` if the arguments are in strictly increasing order (next\none is greater than the previous one). With a single argument\nthe result is always `T`." (doc
86group time) "Measuring, manipulating and displaying time." copy-tree "Return a recursive copy of the list.\n\nUnlike `copy-list`, this function copies subelements of the list\nrecursively.\n\nExamples:\n\n (def a '(1 (2 3)))\n (def b (copy-tree a))\n (equal? a b)\n ; ↳ T\n (eq? a b)\n ; ↳ NIL\n (equal? (cadr a) (cadr b))\n ; ↳ T\n (eq? (cadr a) (cadr b))\n ; ↳ NIL" f32 "Construct a 32-bit floating point number." sin "Return the sine of `r`, where `r` is given in radians." io-copy "Copy bytes from the source IO object to the destination and return\nthe number of bytes copied. If `n` is provided, copy up to that many\nbytes." > "Return `T` if the arguments are in strictly decreasing order (previous\none is greater than the next one)." str-rune "Return the nth rune of the string.\n\nThrows an exception if the index `n` is out of bounds.\n\nExamples:\n\n (str-rune \"йцукен\" 3)\n ; ↳ #\\к" foldl "Reduce the sequences to a single value by repeatedly applying the\nfunction left-associatively.\n\nThe function should be of the form `(fn e₁ e₂ … eₙ acc)`. For each\niteration each `eᵢ` will be set to successive values of the i'th\nsequence. The value `acc` will initially be set to `zero` and\nsubsequently to the previous value of the function application.\n\nThe iteration will terminate once the shortest sequence is exhausted.\n\nFor example, for two sequences (e₁ e₂ … eₙ) and (d₁ d₂ … dₙ), the\nresult will be:\n\n (fn eₙ dₙ (…(fn e₂ d₂ (fn e₁ d₁ zero))…))\n\nNote that `foldl` is tail call recursive.\n\nExamples:\n\n (foldl cons NIL (iota 5))\n ; ↳ (4 3 2 1 0)\n\n (foldl + 0 (iota 5))\n ; ↳ 10\n\n (foldl (λ (x y a) (+ (* x y) a)) 0 (iota 5) (iota 5))\n ; ↳ 30\n\n (foldl (λ (x y a) (cons x (cons y a))) NIL (iota 5) (vec 'a 'b 'c))\n ; ↳ (2 c 1 b 0 a)" +os-version+ "The \"version\" of the operating system StreetLISP VM is running on.\n\nThe availability of the constant and its value depends on the\noperating system and is only provided for the user to see. No logic\nshould depend on it.\n\nExamples:\n\n ; on Alpine Linux\n +os-version+\n ; ↳ \"6.14.5-0-edge\" ; kernel version\n\n ; on 9front\n +os-version+\n ; ↳ NIL ; 9front does not define one" abs "Return absolute value of the argument." with-output-to "Evaluate expressions in `body` with `*io-out*` set to `io` during the\nevaluation.\n\nExamples:\n\n ; write a string \"hello, world!\" to a file\n ; end with a newline\n (with-output-to (file \"/tmp/1.txt\" :create :truncate :write)\n (print \"hello, world!\")\n (newline))" *linefeed* "OS-specific _line_ _feed_ value.\n\nIt is preferred over hardcoded `\"\\n\"`, for portability." str? "Return `T` if the argument is a string, `NIL` otherwise." cons? "Return `T` if `v` is a cons cell, `NIL` otherwise.\n\nExamples:\n\n (cons? 0)\n ; ↳ NIL\n\n (cons? NIL)\n ; ↳ NIL\n\n (cons? '(1))\n ; ↳ T" str-split "Return a list of substrings of `str` by splitting at any character in\nthe string `sep`. The splitting characters are removed.\n\nBy default the string is split on space, line feed (newline),\nhorizontal and vertical tab, and form feed.\n\nTrim removes empty strings from the list.\n\nExamples:\n\n (str-split \"hello world\")\n ; ↳ (\"hello\" \"world\")\n\n (str-split \"multiple spaces \")\n ; ↳ (\"multiple\" \"\" \"\" \"spaces\" \"\")\n\n (str-split \"multiple spaces \" :trim T)\n ; ↳ (\"multiple\" \"spaces\")\n\n (str-split \"too many vowels\" \"aeiou\")\n ; ↳ (\"t\" \"\" \" m\" \"ny v\" \"w\" \"ls\")" io-read "Return a value of the specified type by reading it from the IO\nobject.\n\nThe `type` must specify a fixed-width number, pointer or rune.\n\nNumerical values may be read in a specific endianness order by setting\n`endian` to either `:little-endian` or `:big-endian`. Host CPU\nendianness is used if not specified.\n\nIf the parameter `n` is provided, read `n` values of the type,\nreturning an array of the values or a string when `type` is `utf8`.\n\nExamples:\n\n (io-read f 'utf8 5)\n ; ↳ \"hello\"\n\n (io-read f 'u32)\n ; ↳ 57\n\n (io-read f 'u32 3)\n ; ↳ #arr(u32 0 1 2)\n\n (io-read f 'rune 6)\n ; ↳ #arr(rune #\\λ #\\a #\\m #\\b #\\d #\\a)" truncate "Return the integer value of `x` rounded toward zero.\n\nIf `x` is already an integer (or infinite, or NaN), result is `x`.\n\nExamples:\n\n (truncate -123.45)\n ; ↳ -123\n\n (truncate 299.9)\n ; ↳ 299" aset! "Modify the sequence element specified by the subscripts and return the\nnew value. The sequence can be an array, vector, a list.\nMulti-dimensional sequences of variating types are also supported.\n\nExamples:\n\n (def a '((1 #(2 (3)) 4)))\n (aset! a 1 'x)\n ; ‼ index 1 out of bounds\n (aset! a 0 0 'x)\n ; ↳ x\n a\n ; ↳ ((x #(2 (3)) 4))\n (aset! a 0 1 9)\n ; ↳ 9\n a\n ; ↳ ((x #(9 (3)) 4))" - "Return the result of subtraction. With only one argument a\nnegation is performed.\n\nExamples:\n\n (- 1.5)\n ; ↳ -1.5\n\n (- 3 2)\n ; ↳ 1" makunbound "Make the symbol unbound.\n\nExamples:\n\n (def x 1)\n (bound? 'x)\n ; ↳ T\n x\n ; ↳ 1\n (makunbound 'x)\n (bound? 'x)\n ; ↳ NIL\n x\n ; ‼ eval: variable x has no value" io-truncate "Truncate the underlying IO object to the specified number of bytes." quasiquote "Same as `'expr` but allows evaluating (\"unquoting\") parts of\nthe expression.\n\nShorthand for `(quasiquote expr)`.\n\nExamples:\n\n `(0 1 (+ 2 3)) ; same as (quasiquote (0 1 (+ 2 3)))\n ; ↳ (0 1 (+ 2 3))" io-column! "Change the current column number of the IO object." copy-list "Return a copy of the list.\n\nThe number of elements to be copied can be limited with the optional\nargument `n`.\n\nExamples:\n\n (def a '(1 2 3 4))\n (def b (copy-list a))\n b\n ; ↳ (1 2 3 4)\n (eq? a b)\n ; ↳ NIL\n (equal? a b)\n ; ↳ T\n (copy-list a 3)\n ; ↳ (1 2 3)\n (copy-list a 10)\n ; ↳ (1 2 3 4)" logand "Return the result of bitwise AND operation on integers.\n\nExamples:\n\n (logand)\n ; ↳ 0\n\n (logand 2)\n ; ↳ 2\n\n (logand 2 3)\n ; ↳ 2\n\n (logand 2 3 4)\n ; ↳ 0" time-now "Return the number of nanoseconds since Epoch (1970-01-01 00:00:00).\n\nThis measures the system-wide real (wall-clock) time.\n\nExample:\n\n (time-now)\n ; ↳ 1746494461277334928" sinh "Return the hyperbolic sine of `x`." *argv* "The list of command line arguments.\n\nIf StreetLISP was started in interactive mode without a file specified\nfor execution, `*argv*` will be a list containing just one value - the\nname of the `sl` executable.\n\nOtherwise, the file specified for execution and the rest of the remaining\narguments will form the `*argv*` list.\n\nStreetLISP's own options, such as `-i` and `-H ...` will be stripped\nout in any case.\n\nExamples:\n\n ; $ sl -i -H 12345\n *argv*\n ; ↳ (\"sl\")\n\n ; $ sl script.sl -i abc\n *argv*\n ; ↳ (\"script.sl\" \"-i\" \"abc\")" top-level-exception-handler "Print the exception `e` and the stack trace to `*stderr*`.\n\nThis is the top level exception handler that is used by `load` and\n`repl` functions to handle exceptions that weren't handled at the\nlower level." identity "Return `v`." untrace "Disable tracing for the function bound to the symbol.\n\nExamples:\n\n (trace 'map)\n (map odd? (list (+ 1 2) (+ 3 4)))\n ; ‼ (map #fn(\"n170051S:\" #(even?) odd? 6) (3 7))\n ; ↳ (T T)\n (untrace 'map)\n (map odd? (list (+ 1 2) (+ 3 4)))\n ; ↳ (T T)" count "Return the number of elements in the list that satisfy the predicate.\n\nExamples:\n\n (count (λ (s) (length> s 1))\n '(\"ab\" \"c\" \"d\" \"ef\"))\n ; ↳ 2" io-pos "Return the current absolute position within the IO object in bytes.\n\nExamples:\n\n (def f (buffer))\n (io-write f \"hello, world!\")\n (io-pos f)\n ; ↳ 13" +most-positive-fixnum+ "A constant integer closest to positive infinity that can be\nrepresented by fixnum type on this particular platform." map-int "Return a list of elements generated by repeated calls to `fn`.\n\nThe lambda `fn` will be called with a single argument which is an\nincreasing number in the range `[0, count)` (exclusive). The\nresulting list contains the values returned by `fn`.\n\n\nExamples:\n\n (map-int even? 5)\n ; ↳ (T NIL T NIL T)\n\n (map-int (λ (i) (str i i i)) 4)\n ; ↳ (\"000\" \"111\" \"222\" \"333\")" table->assoc-list "Return the table converted to an association list (pairs of each\nkey and value).\n\nExamples:\n\n (def t #table(a 1 b 2 c 1))\n (table->assoc-list t)\n ; ↳ ((a . 1) (b . 2) (c . 1))" length< "Shorthand for a bounded length test `(< (length seq) n)`." unless "Shorthand for `(if cond NIL body)`.\n\nA non-empty body is required.\n\nExamples:\n\n (unless (cons? x)\n (princ \"oops!\")\n (newline)\n (type-error 'cons x))" str->time "Return the number of nanoseconds since Epoch from a time and date\nformatted as a string.\n\nBecause the supported format is limited, the returned value will have\nprecision in seconds at most.\n\nExamples:\n\n (str->time \"Tue May 6 03:21:01 CES 2025\")\n ; ↳ 1746494461" get-syntax "Return a macro application function based on its name, or `NIL` if\nit's not defined." (doc87group time) "Measuring, manipulating and displaying time." copy-tree "Return a recursive copy of the list.\n\nUnlike `copy-list`, this function copies subelements of the list\nrecursively.\n\nExamples:\n\n (def a '(1 (2 3)))\n (def b (copy-tree a))\n (equal? a b)\n ; ↳ T\n (eq? a b)\n ; ↳ NIL\n (equal? (cadr a) (cadr b))\n ; ↳ T\n (eq? (cadr a) (cadr b))\n ; ↳ NIL" f32 "Construct a 32-bit floating point number." sin "Return the sine of `r`, where `r` is given in radians." io-copy "Copy bytes from the source IO object to the destination and return\nthe number of bytes copied. If `n` is provided, copy up to that many\nbytes." > "Return `T` if the arguments are in strictly decreasing order (previous\none is greater than the next one)." str-rune "Return the nth rune of the string.\n\nThrows an exception if the index `n` is out of bounds.\n\nExamples:\n\n (str-rune \"йцукен\" 3)\n ; ↳ #\\к" foldl "Reduce the sequences to a single value by repeatedly applying the\nfunction left-associatively.\n\nThe function should be of the form `(fn e₁ e₂ … eₙ acc)`. For each\niteration each `eᵢ` will be set to successive values of the i'th\nsequence. The value `acc` will initially be set to `zero` and\nsubsequently to the previous value of the function application.\n\nThe iteration will terminate once the shortest sequence is exhausted.\n\nFor example, for two sequences (e₁ e₂ … eₙ) and (d₁ d₂ … dₙ), the\nresult will be:\n\n (fn eₙ dₙ (…(fn e₂ d₂ (fn e₁ d₁ zero))…))\n\nNote that `foldl` is tail call recursive.\n\nExamples:\n\n (foldl cons NIL (iota 5))\n ; ↳ (4 3 2 1 0)\n\n (foldl + 0 (iota 5))\n ; ↳ 10\n\n (foldl (λ (x y a) (+ (* x y) a)) 0 (iota 5) (iota 5))\n ; ↳ 30\n\n (foldl (λ (x y a) (cons x (cons y a))) NIL (iota 5) (vec 'a 'b 'c))\n ; ↳ (2 c 1 b 0 a)" +os-version+ "The \"version\" of the operating system StreetLISP VM is running on.\n\nThe availability of the constant and its value depends on the\noperating system and is only provided for the user to see. No logic\nshould depend on it.\n\nExamples:\n\n ; on Alpine Linux\n +os-version+\n ; ↳ \"6.14.5-0-edge\" ; kernel version\n\n ; on 9front\n +os-version+\n ; ↳ NIL ; 9front does not define one" abs "Return absolute value of the argument." with-output-to "Evaluate expressions in `body` with `*io-out*` set to `io` during the\nevaluation.\n\nExamples:\n\n ; write a string \"hello, world!\" to a file\n ; end with a newline\n (with-output-to (file \"/tmp/1.txt\" :create :truncate :write)\n (print \"hello, world!\")\n (newline))" *linefeed* "OS-specific _line_ _feed_ value.\n\nIt is preferred over hardcoded `\"\\n\"`, for portability." str? "Return `T` if the argument is a string, `NIL` otherwise." cons? "Return `T` if `v` is a cons cell, `NIL` otherwise.\n\nExamples:\n\n (cons? 0)\n ; ↳ NIL\n\n (cons? NIL)\n ; ↳ NIL\n\n (cons? '(1))\n ; ↳ T" str-split "Return a list of substrings of `str` by splitting at any character in\nthe string `sep`. The splitting characters are removed.\n\nBy default the string is split on space, line feed (newline),\nhorizontal and vertical tab, and form feed.\n\nTrim removes empty strings from the list.\n\nExamples:\n\n (str-split \"hello world\")\n ; ↳ (\"hello\" \"world\")\n\n (str-split \"multiple spaces \")\n ; ↳ (\"multiple\" \"\" \"\" \"spaces\" \"\")\n\n (str-split \"multiple spaces \" :trim T)\n ; ↳ (\"multiple\" \"spaces\")\n\n (str-split \"too many vowels\" \"aeiou\")\n ; ↳ (\"t\" \"\" \" m\" \"ny v\" \"w\" \"ls\")" io-read "Return a value of the specified type by reading it from the IO\nobject.\n\nThe `type` must specify a fixed-width number, pointer or rune.\n\nNumerical values may be read in a specific endianness order by setting\n`endian` to either `:little-endian` or `:big-endian`. Host CPU\nendianness is used if not specified.\n\nIf the parameter `n` is provided, read `n` values of the type,\nreturning an array of the values or a string when `type` is `utf8`.\n\nExamples:\n\n (io-read f 'utf8 5)\n ; ↳ \"hello\"\n\n (io-read f 'u32)\n ; ↳ 57\n\n (io-read f 'u32 3)\n ; ↳ #arr(u32 0 1 2)\n\n (io-read f 'rune 6)\n ; ↳ #arr(rune #\\λ #\\a #\\m #\\b #\\d #\\a)" truncate "Return the integer value of `x` rounded toward zero.\n\nIf `x` is already an integer (or infinite, or NaN), result is `x`.\n\nExamples:\n\n (truncate -123.45)\n ; ↳ -123\n\n (truncate 299.9)\n ; ↳ 299" aset! "Modify the sequence element specified by the subscripts and return the\nnew value. The sequence can be an array, vector, a list.\nMulti-dimensional sequences of variating types are also supported.\n\nExamples:\n\n (def a '((1 #(2 (3)) 4)))\n (aset! a 1 'x)\n ; ‼ index 1 out of bounds\n (aset! a 0 0 'x)\n ; ↳ x\n a\n ; ↳ ((x #(2 (3)) 4))\n (aset! a 0 1 9)\n ; ↳ 9\n a\n ; ↳ ((x #(9 (3)) 4))" - "Return the result of subtraction. With only one argument a\nnegation is performed.\n\nExamples:\n\n (- 1.5)\n ; ↳ -1.5\n\n (- 3 2)\n ; ↳ 1" makunbound "Make the symbol unbound.\n\nExamples:\n\n (def x 1)\n (bound? 'x)\n ; ↳ T\n x\n ; ↳ 1\n (makunbound 'x)\n (bound? 'x)\n ; ↳ NIL\n x\n ; ‼ eval: variable x has no value" io-truncate "Truncate the underlying IO object to the specified number of bytes." quasiquote "Same as `'expr` but allows evaluating (\"unquoting\") parts of\nthe expression.\n\nShorthand for `(quasiquote expr)`.\n\nExamples:\n\n `(0 1 (+ 2 3)) ; same as (quasiquote (0 1 (+ 2 3)))\n ; ↳ (0 1 (+ 2 3))" io-column! "Change the current column number of the IO object." copy-list "Return a copy of the list.\n\nThe number of elements to be copied can be limited with the optional\nargument `n`.\n\nExamples:\n\n (def a '(1 2 3 4))\n (def b (copy-list a))\n b\n ; ↳ (1 2 3 4)\n (eq? a b)\n ; ↳ NIL\n (equal? a b)\n ; ↳ T\n (copy-list a 3)\n ; ↳ (1 2 3)\n (copy-list a 10)\n ; ↳ (1 2 3 4)" logand "Return the result of bitwise AND operation on integers.\n\nExamples:\n\n (logand)\n ; ↳ 0\n\n (logand 2)\n ; ↳ 2\n\n (logand 2 3)\n ; ↳ 2\n\n (logand 2 3 4)\n ; ↳ 0" time-now "Return the number of nanoseconds since Epoch (1970-01-01 00:00:00).\n\nThis measures the system-wide real (wall-clock) time.\n\nExample:\n\n (time-now)\n ; ↳ 1746494461277334928" sinh "Return the hyperbolic sine of `x`." *argv* "The list of command line arguments.\n\nIf StreetLISP was started in interactive mode without a file specified\nfor execution, `*argv*` will be a list containing just one value - the\nname of the `sl` executable.\n\nOtherwise, the file specified for execution and the rest of the remaining\narguments will form the `*argv*` list.\n\nStreetLISP's own options, such as `-i` and `-H ...` will be stripped\nout in any case.\n\nExamples:\n\n ; $ sl -i -H 12345\n *argv*\n ; ↳ (\"sl\")\n\n ; $ sl script.sl -i abc\n *argv*\n ; ↳ (\"script.sl\" \"-i\" \"abc\")" top-level-exception-handler "Print the exception `e` and the stack trace to `*stderr*`.\n\nThis is the top level exception handler that is used by `load` and\n`repl` functions to handle exceptions that weren't handled at the\nlower level." identity "Return `v`." untrace "Disable tracing for the function bound to the symbol.\n\nExamples:\n\n (trace 'map)\n (map odd? (list (+ 1 2) (+ 3 4)))\n ; ‼ (map #fn(\"n170051S:\" #(even?) odd? 6) (3 7))\n ; ↳ (T T)\n (untrace 'map)\n (map odd? (list (+ 1 2) (+ 3 4)))\n ; ↳ (T T)" count "Return the number of elements in the list that satisfy the predicate.\n\nExamples:\n\n (count (λ (s) (length> s 1))\n '(\"ab\" \"c\" \"d\" \"ef\"))\n ; ↳ 2" io-pos "Return the current absolute position within the IO object in bytes.\n\nExamples:\n\n (def f (buffer))\n (io-write f \"hello, world!\")\n (io-pos f)\n ; ↳ 13" +most-positive-fixnum+ "A constant integer closest to positive infinity that can be\nrepresented by fixnum type on this particular platform." map-int "Return a list of elements generated by repeated calls to `fn`.\n\nThe lambda `fn` will be called with a single argument which is an\nincreasing number in the range `[0, count)` (exclusive). The\nresulting list contains the values returned by `fn`.\n\n\nExamples:\n\n (map-int even? 5)\n ; ↳ (T NIL T NIL T)\n\n (map-int (λ (i) (str i i i)) 4)\n ; ↳ (\"000\" \"111\" \"222\" \"333\")" table->assoc-list "Return the table converted to an association list (pairs of each\nkey and value).\n\nExamples:\n\n (def t #table(a 1 b 2 c 1))\n (table->assoc-list t)\n ; ↳ ((a . 1) (b . 2) (c . 1))" length< "Shorthand for a bounded length test `(< (length seq) n)`." unless "Shorthand for `(if cond NIL body)`.\n\nA non-empty body is required.\n\nExamples:\n\n (unless (cons? x)\n (princ \"oops!\")\n (newline)\n (type-error 'cons x))" str->time "Return the number of nanoseconds since Epoch from a time and date\nformatted as a string.\n\nBecause the supported format is limited, the returned value will have\nprecision in seconds at most.\n\nExamples:\n\n (str->time \"Tue May 6 03:21:01 CES 2025\")\n ; ↳ 1746494461" get-syntax "Return a macro application function based on its name, or `NIL` if\nit's not defined." (doc
87group table) "Tables of keys with associated values." ptr? "Return `T` if the argument is an abstract pointer, `NIL` otherwise." expt "Return the value of `x` raised to the power of `p`.\n\nExamples:\n\n (expt 3 3) ; cube of 3\n ; ↳ 27\n\n (expt 27 (/ 1 3)) ; cube root of 27\n ; ↳ 3" io-read-all "Return a string containing all of the data read from the IO object\nuntil it ran out of data.\n\nAn empty string (`\"\"`) is returned if the IO object had no data.\n\nExamples:\n\n ; read current user on Plan 9\n (io-read-all (file \"/dev/user\"))\n ; ↳ \"glenda\"" gc "Force a garbage collection run.\n\nOne does not need to execute this function manually since garbage\ncollection will happen automatically, based on the amount of data\nallocated." io-write "Write the value to the IO object, return the number of bytes written.\n\nThe value may be a string, a fixed-width number or pointer, a rune\nor an array.\n\nNumerical values may be written in a specific endianness order by\nsetting `endian` to either `:little-endian` or `:big-endian`. Host\nCPU endianness is used if not specified.\n\nWhen writing a rune or an array of runes, they will be converted and\nwritten as an UTF-8 string.\n\nExamples:\n\n (io-write *stdout* \"hello\")\n ; ‼ hello\n ; ↳ 5\n\n (io-write *stdout* (u32 #x44434241) :little-endian)\n ; ‼ ABCD\n ; ↳ 4\n\n (io-write *stdout* #\\λ)\n ; ‼ λ\n ; ↳ 2\n\n (io-write *stdout* (arr 'rune #\\λ #\\= #\\l #\\a #\\m #\\b #\\d #\\a))\n ; ‼ λ=lambda\n ; ↳ 9" table-invert "Return a new table with the keys and values from the original table\nbut entries _inverted_ - values to keys and keys to values.\n\nNote that if the original table had several keys mapped to the same\nvalue, only one such mapping will be stored in the new table.\n\nExamples:\n\n (def t #table(a 1 b 2 c 1))\n (table-invert t)\n ; ↳ #table(1 a 2 b)" lz-unpack "Return decompressed data previously compressed using lz-pack.\n\nEither destination for the decompressed data or the expected size of\nthe decompressed data must be specified. In the latter case a new\narray is allocated." div "Return the quotient of the Euclidean division `a/n`.\n\nExamples:\n\n (div 10 3)\n ; ↳ 3\n\n (div -10 3)\n ; ↳ -4\n\n (div -10 -3)\n ; ↳ 4\n\n (div 10 -3)\n ; ↳ -3" princ "Print the arguments to *io-out* with `*print-readably*` set to `NIL`.\n\nExamples:\n\n (princ 1 2 \"abc\")\n ; ‼ 12abc" (doc88group table) "Tables of keys with associated values." ptr? "Return `T` if the argument is an abstract pointer, `NIL` otherwise." expt "Return the value of `x` raised to the power of `p`.\n\nExamples:\n\n (expt 3 3) ; cube of 3\n ; ↳ 27\n\n (expt 27 (/ 1 3)) ; cube root of 27\n ; ↳ 3" io-read-all "Return a string containing all of the data read from the IO object\nuntil it ran out of data.\n\nAn empty string (`\"\"`) is returned if the IO object had no data.\n\nExamples:\n\n ; read current user on Plan 9\n (io-read-all (file \"/dev/user\"))\n ; ↳ \"glenda\"" gc "Force a garbage collection run.\n\nOne does not need to execute this function manually since garbage\ncollection will happen automatically, based on the amount of data\nallocated." io-write "Write the value to the IO object, return the number of bytes written.\n\nThe value may be a string, a fixed-width number or pointer, a rune\nor an array.\n\nNumerical values may be written in a specific endianness order by\nsetting `endian` to either `:little-endian` or `:big-endian`. Host\nCPU endianness is used if not specified.\n\nWhen writing a rune or an array of runes, they will be converted and\nwritten as an UTF-8 string.\n\nExamples:\n\n (io-write *stdout* \"hello\")\n ; ‼ hello\n ; ↳ 5\n\n (io-write *stdout* (u32 #x44434241) :little-endian)\n ; ‼ ABCD\n ; ↳ 4\n\n (io-write *stdout* #\\λ)\n ; ‼ λ\n ; ↳ 2\n\n (io-write *stdout* (arr 'rune #\\λ #\\= #\\l #\\a #\\m #\\b #\\d #\\a))\n ; ‼ λ=lambda\n ; ↳ 9" table-invert "Return a new table with the keys and values from the original table\nbut entries _inverted_ - values to keys and keys to values.\n\nNote that if the original table had several keys mapped to the same\nvalue, only one such mapping will be stored in the new table.\n\nExamples:\n\n (def t #table(a 1 b 2 c 1))\n (table-invert t)\n ; ↳ #table(1 a 2 b)" lz-unpack "Return decompressed data previously compressed using lz-pack.\n\nEither destination for the decompressed data or the expected size of\nthe decompressed data must be specified. In the latter case a new\narray is allocated." div "Return the quotient of the Euclidean division `a/n`.\n\nExamples:\n\n (div 10 3)\n ; ↳ 3\n\n (div -10 3)\n ; ↳ -4\n\n (div -10 -3)\n ; ↳ 4\n\n (div 10 -3)\n ; ↳ -3" princ "Print the arguments to *io-out* with `*print-readably*` set to `NIL`.\n\nExamples:\n\n (princ 1 2 \"abc\")\n ; ‼ 12abc" (doc
88group struct) "Declaring and manipulating structures." last-cdr "Return the second element of the last cell in the list.\n\nIt will always evaluate to `NIL` with any proper list.\n\nExamples:\n\n (last-cdr '(1 2 3))\n ; ↳ NIL\n\n (last-cdr '(1 2 . 3))\n ; ↳ 3" trace "Enable tracing for the function bound to the symbol.\n\nWhen tracing is enabled for the function, before evaluating the call\nthe name and arguments will be printed to `*io-out*`.\n\nExamples:\n\n (trace 'map)\n (map odd? (list (+ 1 2) (+ 3 4)))\n ; ‼ (map #fn(\"n170051S:\" #(even?) odd? 6) (3 7))\n ; ↳ (T T)" io-filename "Return the filename of the IO object.\n\nExamples:\n\n (def f (file \"/dev/random\"))\n (io-filename f)\n ; ↳ \"/dev/random\"\n (io-close f)\n (io-filename f) ; preserved even after it's closed\n ; ↳ \"/dev/random\"\n\n (io-filename *io-out*)\n ; ↳ \"*stdout*\"" gensym? "Return `T` if the argument is a gensym, `NIL` otherwise." (doc89group struct) "Declaring and manipulating structures." last-cdr "Return the second element of the last cell in the list.\n\nIt will always evaluate to `NIL` with any proper list.\n\nExamples:\n\n (last-cdr '(1 2 3))\n ; ↳ NIL\n\n (last-cdr '(1 2 . 3))\n ; ↳ 3" trace "Enable tracing for the function bound to the symbol.\n\nWhen tracing is enabled for the function, before evaluating the call\nthe name and arguments will be printed to `*io-out*`.\n\nExamples:\n\n (trace 'map)\n (map odd? (list (+ 1 2) (+ 3 4)))\n ; ‼ (map #fn(\"n170051S:\" #(even?) odd? 6) (3 7))\n ; ↳ (T T)" io-filename "Return the filename of the IO object.\n\nExamples:\n\n (def f (file \"/dev/random\"))\n (io-filename f)\n ; ↳ \"/dev/random\"\n (io-close f)\n (io-filename f) ; preserved even after it's closed\n ; ↳ \"/dev/random\"\n\n (io-filename *io-out*)\n ; ↳ \"*stdout*\"" let* "Same as the second form of `let` but each of the binding expressions\nmay reference any of the varibles bound previously.\n\nExamples:\n\n (let* ((a 1)\n (b (+ a 1))\n (c (+ b 1)))\n c)\n ; ↳ 3" gensym? "Return `T` if the argument is a gensym, `NIL` otherwise." (doc
89group syntax) "StreetLISP syntax and macros." defdoc "Define documentation for a top level term.\n\nIf `term` is a function signature and `doc` is not specified, just\nthe signature will be included in the documentation, without\nreplacing any previously defined.\n\nFirst `doc` argument is supposed to be a string with the description\nof the term. The following arguments are expected to be optional tag\npairings that provide grouping for multiple symbols and \"see also\"\nreferences.\n\nUseful in cases where setting the documentation for a term can't\n(or not preferred to) be done during the definition of said term.\nOne of those reasons could be that the term is a built-in function\nimplemented in C.\n\nExamples:\n\n (defdoc (func arg (arg2 0))\n \"Return something about the `arg` and `arg2`. This is a short\n description.\n\n This is the longer description, following the short one.\n\n Examples:\n\n (func 0)\n ; ↳ T\n\n (func 1 3)\n ; ↳ NIL\"\n :doc-group stuff\n :doc-see func2)\n (defdoc (func arg (:another-variant NIL)))" cdddr "Shorthand for (cdr (cdr (cdr lst)))." copy-table "Return a new copy of the table with the keys and values preserved.\n\nNo copies of the keys nor values are created - original ones are\nreused.\n\nExamples:\n\n (def t #table(a (1 2 3)))\n (def q (copy-table t))\n (eq? t q)\n ; ↳ NIL\n (eq? (get t 'a) (get q 'a))\n ; ↳ T" set-car! "Modify a cons cell (a list) in-place by putting `new-first` as its\nfirst element (head of the list). Return the modified cons\ncell (list).\n\nExamples:\n\n (def q '(1 2 3 4 5))\n (set-car! q 0)\n ; ↳ (0 6 7)\n q\n ; ↳ (0 6 7)" partition "Return two lists where the first contains the elements of the original\nlist which satisfy the predicate and the second containing the rest of\nthe elements.\n\nBoth lists will have the elements appear in the same order as in the\noriginal list.\n\nExamples:\n\n ; split the list into numbers and non-numbers\n (def q '(1a 1 0 2b e 3))\n (receive (nums other) (partition num? q)\n (print nums other)\n (newline))\n ; ↳ (1 0 3) (1a 2b e)" has? "Return `T` if the table has a value associated with the key, `NIL` otherwise.\n\nExamples:\n\n (def t #table(a 1 b 2))\n (has? t 'c)\n ; ↳ NIL\n (has? t 'a)\n ; ↳ T" vec "Construct a vector containing the specified arguments.\n\nExamples:\n\n (vec) ; empty vector\n ; ↳ #()\n\n (vec 1 2.5 \"a\" 'b)\n ; ↳ #(1 2.5 \"a\" b)" while "Evaluate the body expressions until `cond` evaluates to `NIL`.\n\nExamples:\n\n (def x 3)\n (while (> x 0)\n (princ #\\x)\n (set! x (1- x)))\n ; ‼ xxx" rune "Construct a rune from a Unicode code point. Without code point\nspecified, an \"invalid\" rune is returned." *exit-hooks* "Internal variable, a list containing functions to call right before VM\nprocess exits." cadar "Shorthand for (car (cdr (car lst)))." type-error "Raise a type error exception." file "Open a file for I/O.\n\nAn `io` object is returned. Without any modes specified the file\nmust already exist and is opened in read-only mode.\n\nFiles are created with the default mode bits #o644." nth "Return nth element of the list, or `NIL` if the list is shorter.\n\nExamples:\n\n (def l '(a b c))\n (nth l 0)\n ; ↳ a\n (nth l 2)\n ; ↳ c\n (nth l 10)\n ; ↳ NIL" cdr "Return the second element of a cons cell (tail of a list) or `NIL` if\nnot available.\n\nExamples:\n\n (cdr NIL)\n ; ↳ NIL\n\n (cdr '(1 2 3))\n ; ↳ (2 3)\n\n (cdr '(1 . 2))\n ; ↳ 2" / "Return the division of the arguments. With only one argument the\nresult of `1/x` is returned. If the result is integer-valued, it is\nreturned as an integer.\n\nExamples:\n\n (/ 2)\n ; ↳ 0.5\n\n (/ 7 2 2)\n ; ↳ 1.75\n\n (/ 10 -2)\n ; ↳ -5 ; a fixnum\n\n (/ 6.9 1.9)\n ; ↳ 3.6315…" newline "Write a single OS-specific line feed to the output.\n\nOn most systems it's a single character - `#\\linefeed` (`\\n`)." separate-doc-from-body "Take a list of terms and return a pair `(doc . body)`, where the first\nelement contains a list of documentation-related terms, and the second\ncontains the rest of the terms." cdadar "Shorthand for (cdr (car (cdr (car lst))))." foldr "Reduce the sequences to a single value by repeatedly applying the\nfunction right-associatively.\n\nThe function should be of the form `(fn e₁ e₂ … eₙ acc)`. For each\niteration each `eᵢ` will be set to successive values of the i'th\nsequence. The value `acc` will initially be set to `zero` and\nsubsequently to the previous value of the function application.\n\nThe iteration will terminate once the shortest sequence is exhausted.\n\nFor example, for two sequences (e₁ e₂ … eₙ) and (d₁ d₂ … dₙ), the\nresult will be:\n\n (fn e₁ d₁ (fn e₂ d₂ (…(fn eₙ dₙ zero)…)))\n\nNote that `foldr` is NOT tail call recursive.\n\nExamples:\n\n (foldr cons NIL (iota 5))\n ; ↳ (0 1 2 3 4)\n\n (foldr + 0 (iota 5))\n ; ↳ 10\n\n (foldr (λ (x y a) (+ (* x y) a)) 0 (iota 5) (iota 5))\n ; ↳ 30\n\n (foldr (λ (x y a) (cons x (cons y a))) NIL (iota 5) (vec 'a 'b 'c))\n ; ↳ (0 a 1 b 2 c)" sqrt "Return the square root of `x`.\n\nExamples:\n\n (sqrt 9.0)\n ; ↳ 3.0" reverse "Return the list with its elements in reverse order.\n\nThe original list is copied to construct the reversed version.\n\nExamples:\n\n (def a '(1 2 3))\n (reverse a)\n ; ↳ (3 2 1)\n a\n ; ↳ (1 2 3)" lz-pack "Return data compressed using Lempel-Ziv.\n\nThe data must be an array, returned value will have the same type.\nThe optional `level` is between `0` and `10`. With `level` set to\n`0` a simple LZSS using hashing will be performed. Levels between\n`1` and `9` offer a trade-off between time/space and ratio. Level\n`10` is optimal but very slow." *prompt* "Function called by REPL to tell the user it's expecting input.\n\nThe default `*prompt*` function prints `#;> `, which by itself is a\ncommented-out expression, allowing the user to copy-paste the entire\nline (with the prompt) to re-evaluate." member "Return the tail of a list beginning with the item, or `NIL` otherwise.\nList elements are compared to the `item` using `equal?`.\n\nExamples:\n\n (member 1 '(3 2 1 0))\n ; ↳ (1 0)\n\n (member 1 '(2 3))\n ; ↳ NIL" bignum? "Return `T` if the argument is a bignum, `NIL` otherwise." fixnum "Construct a fixnum." f64 "Construct a 64-bit floating point number." memq "Return the tail of a list beginning with the item, or `NIL` otherwise.\nList elements are compared to the `item` using `eq?`." str->num "Return the number using the radix `base` in the string `s`.\n\nReturns `NIL` if the number could not be parsed or there were\nleft-over trailing characters.\n\nExamples:\n\n (str->num \"1.2\")\n ; ↳ 1.2\n\n (str->num \"#x123\")\n ; ↳ 291\n\n (str->num \"ffff\" 16)\n ; ↳ 65535\n\n (str->num \"777\" 8)\n ; ↳ 511" exp "Return the exponential - value of `e` (natural logarithms base) raised\nto the power of `p`.\n\nExamples:\n\n (exp 1)\n ; ↳ 2.71828… ; e" (doc90group syntax) "StreetLISP syntax and macros." defdoc "Define documentation for a top level term.\n\nIf `term` is a function signature and `doc` is not specified, just\nthe signature will be included in the documentation, without\nreplacing any previously defined.\n\nFirst `doc` argument is supposed to be a string with the description\nof the term. The following arguments are expected to be optional tag\npairings that provide grouping for multiple symbols and \"see also\"\nreferences.\n\nUseful in cases where setting the documentation for a term can't\n(or not preferred to) be done during the definition of said term.\nOne of those reasons could be that the term is a built-in function\nimplemented in C.\n\nExamples:\n\n (defdoc (func arg (arg2 0))\n \"Return something about the `arg` and `arg2`. This is a short\n description.\n\n This is the longer description, following the short one.\n\n Examples:\n\n (func 0)\n ; ↳ T\n\n (func 1 3)\n ; ↳ NIL\"\n :doc-group stuff\n :doc-see func2)\n (defdoc (func arg (:another-variant NIL)))" cdddr "Shorthand for (cdr (cdr (cdr lst)))." copy-table "Return a new copy of the table with the keys and values preserved.\n\nNo copies of the keys nor values are created - original ones are\nreused.\n\nExamples:\n\n (def t #table(a (1 2 3)))\n (def q (copy-table t))\n (eq? t q)\n ; ↳ NIL\n (eq? (get t 'a) (get q 'a))\n ; ↳ T" set-car! "Modify a cons cell (a list) in-place by putting `new-first` as its\nfirst element (head of the list). Return the modified cons\ncell (list).\n\nExamples:\n\n (def q '(1 2 3 4 5))\n (set-car! q 0)\n ; ↳ (0 6 7)\n q\n ; ↳ (0 6 7)" partition "Return two lists where the first contains the elements of the original\nlist which satisfy the predicate and the second containing the rest of\nthe elements.\n\nBoth lists will have the elements appear in the same order as in the\noriginal list.\n\nExamples:\n\n ; split the list into numbers and non-numbers\n (def q '(1a 1 0 2b e 3))\n (receive (nums other) (partition num? q)\n (print nums other)\n (newline))\n ; ↳ (1 0 3) (1a 2b e)" has? "Return `T` if the table has a value associated with the key, `NIL` otherwise.\n\nExamples:\n\n (def t #table(a 1 b 2))\n (has? t 'c)\n ; ↳ NIL\n (has? t 'a)\n ; ↳ T" vec "Construct a vector containing the specified arguments.\n\nExamples:\n\n (vec) ; empty vector\n ; ↳ #()\n\n (vec 1 2.5 \"a\" 'b)\n ; ↳ #(1 2.5 \"a\" b)" while "Evaluate the body expressions until `cond` evaluates to `NIL`.\n\nExamples:\n\n (def x 3)\n (while (> x 0)\n (princ #\\x)\n (set! x (1- x)))\n ; ‼ xxx" rune "Construct a rune from a Unicode code point. Without code point\nspecified, an \"invalid\" rune is returned." *exit-hooks* "Internal variable, a list containing functions to call right before VM\nprocess exits." cadar "Shorthand for (car (cdr (car lst)))." type-error "Raise a type error exception." file "Open a file for I/O.\n\nAn `io` object is returned. Without any modes specified the file\nmust already exist and is opened in read-only mode.\n\nFiles are created with the default mode bits #o644." nth "Return nth element of the list, or `NIL` if the list is shorter.\n\nExamples:\n\n (def l '(a b c))\n (nth l 0)\n ; ↳ a\n (nth l 2)\n ; ↳ c\n (nth l 10)\n ; ↳ NIL" cdr "Return the second element of a cons cell (tail of a list) or `NIL` if\nnot available.\n\nExamples:\n\n (cdr NIL)\n ; ↳ NIL\n\n (cdr '(1 2 3))\n ; ↳ (2 3)\n\n (cdr '(1 . 2))\n ; ↳ 2" / "Return the division of the arguments. With only one argument the\nresult of `1/x` is returned. If the result is integer-valued, it is\nreturned as an integer.\n\nExamples:\n\n (/ 2)\n ; ↳ 0.5\n\n (/ 7 2 2)\n ; ↳ 1.75\n\n (/ 10 -2)\n ; ↳ -5 ; a fixnum\n\n (/ 6.9 1.9)\n ; ↳ 3.6315…" newline "Write a single OS-specific line feed to the output.\n\nOn most systems it's a single character - `#\\linefeed` (`\\n`)." separate-doc-from-body "Take a list of terms and return a pair `(doc . body)`, where the first\nelement contains a list of documentation-related terms, and the second\ncontains the rest of the terms." cdadar "Shorthand for (cdr (car (cdr (car lst))))." foldr "Reduce the sequences to a single value by repeatedly applying the\nfunction right-associatively.\n\nThe function should be of the form `(fn e₁ e₂ … eₙ acc)`. For each\niteration each `eᵢ` will be set to successive values of the i'th\nsequence. The value `acc` will initially be set to `zero` and\nsubsequently to the previous value of the function application.\n\nThe iteration will terminate once the shortest sequence is exhausted.\n\nFor example, for two sequences (e₁ e₂ … eₙ) and (d₁ d₂ … dₙ), the\nresult will be:\n\n (fn e₁ d₁ (fn e₂ d₂ (…(fn eₙ dₙ zero)…)))\n\nNote that `foldr` is NOT tail call recursive.\n\nExamples:\n\n (foldr cons NIL (iota 5))\n ; ↳ (0 1 2 3 4)\n\n (foldr + 0 (iota 5))\n ; ↳ 10\n\n (foldr (λ (x y a) (+ (* x y) a)) 0 (iota 5) (iota 5))\n ; ↳ 30\n\n (foldr (λ (x y a) (cons x (cons y a))) NIL (iota 5) (vec 'a 'b 'c))\n ; ↳ (0 a 1 b 2 c)" sqrt "Return the square root of `x`.\n\nExamples:\n\n (sqrt 9.0)\n ; ↳ 3.0" reverse "Return the list with its elements in reverse order.\n\nThe original list is copied to construct the reversed version.\n\nExamples:\n\n (def a '(1 2 3))\n (reverse a)\n ; ↳ (3 2 1)\n a\n ; ↳ (1 2 3)" lz-pack "Return data compressed using Lempel-Ziv.\n\nThe data must be an array, returned value will have the same type.\nThe optional `level` is between `0` and `10`. With `level` set to\n`0` a simple LZSS using hashing will be performed. Levels between\n`1` and `9` offer a trade-off between time/space and ratio. Level\n`10` is optimal but very slow." *prompt* "Function called by REPL to tell the user it's expecting input.\n\nThe default `*prompt*` function prints `#;> `, which by itself is a\ncommented-out expression, allowing the user to copy-paste the entire\nline (with the prompt) to re-evaluate." member "Return the tail of a list beginning with the item, or `NIL` otherwise.\nList elements are compared to the `item` using `equal?`.\n\nExamples:\n\n (member 1 '(3 2 1 0))\n ; ↳ (1 0)\n\n (member 1 '(2 3))\n ; ↳ NIL" bignum? "Return `T` if the argument is a bignum, `NIL` otherwise." fixnum "Construct a fixnum." f64 "Construct a 64-bit floating point number." memq "Return the tail of a list beginning with the item, or `NIL` otherwise.\nList elements are compared to the `item` using `eq?`." str->num "Return the number using the radix `base` in the string `s`.\n\nReturns `NIL` if the number could not be parsed or there were\nleft-over trailing characters.\n\nExamples:\n\n (str->num \"1.2\")\n ; ↳ 1.2\n\n (str->num \"#x123\")\n ; ↳ 291\n\n (str->num \"ffff\" 16)\n ; ↳ 65535\n\n (str->num \"777\" 8)\n ; ↳ 511" exp "Return the exponential - value of `e` (natural logarithms base) raised\nto the power of `p`.\n\nExamples:\n\n (exp 1)\n ; ↳ 2.71828… ; e" (doc
90group debug) "Debugging utilities." +most-negative-fixnum+ "A constant integer closest to negative infinity that can be\nrepresented by fixnum type on this particular platform." caaaar "Shorthand for (car (car (car (car lst))))." io-column "Return the current column number of the IO object.\n\nColumn number is purely informative and is only being automatically\nupdated with the files opened for reading. If the cursor position is\nchanged via `io-skip` or `io-pos!`, the behavior is undefined." traced? "Return `T` if the tracing is enabled for the function, `NIL`\notherwise.\n\nExamples:\n\n (traced? map)\n ; ↳ NIL\n (trace 'map)\n (traced? map)\n ; ↳ T\n (untrace 'map)\n (traced? map)\n ; ↳ NIL" (doc91group debug) "Debugging utilities." +most-negative-fixnum+ "A constant integer closest to negative infinity that can be\nrepresented by fixnum type on this particular platform." caaaar "Shorthand for (car (car (car (car lst))))." io-column "Return the current column number of the IO object.\n\nColumn number is purely informative and is only being automatically\nupdated with the files opened for reading. If the cursor position is\nchanged via `io-skip` or `io-pos!`, the behavior is undefined." traced? "Return `T` if the tracing is enabled for the function, `NIL`\notherwise.\n\nExamples:\n\n (traced? map)\n ; ↳ NIL\n (trace 'map)\n (traced? map)\n ; ↳ T\n (untrace 'map)\n (traced? map)\n ; ↳ NIL" (doc
91group io) "Files and I/O functionality." s64 "Construct a 64-bit signed number." io-flush "Flush the contents of the output buffer to the underlying IO." assoc "Return a pair of a matching key and the associated value, or `NIL` if\nnone matched. Keys are compared using `equal?`.\n\nExamples:\n\n (def L (assoc-list 'a 0 'b 1))\n (assoc 'b L)\n ; ↳ (b . 1)\n (assoc 'c L)\n ; ↳ NIL" + "Return sum of the arguments or `0` when none specified." cadadr "Shorthand for (car (cdr (car (cdr lst))))." foldr1 "Same as `foldr` but using the first element of the sequence as the\ninitial accumulator.\n\nExamples:\n\n (foldr1 + (iota 10))\n ; ↳ 45" compare "Return -1 if `x` is less than `y`, 0 if equal, and `1` if `y` is\ngreater than `x`.\n\nExamples:\n\n (compare 'a 'b)\n ; ↳ -1\n\n (compare 1 1)\n ; ↳ 0\n\n (compare \"b\" \"a\")\n ; ↳ 1" length "Return the length of the sequence.\n\nString's length is measured in UTF-8 codepoints. For tables the number\nof key-value pairs is returned.\n\nNote: for circular lists the result is `NIL`. A type error exception is\nthrown on improper lists, which are not considered valid sequences.\n\nExamples:\n\n (length \"абвгд\")\n ; ↳ 5\n (length #(abc 123))\n ; ↳ 2\n (length #table(0 a 1 b 2 c))\n ; ↳ 3\n (length (arr 'u32 1 2 3 4))\n ; ↳ 4\n (length '(1 2 3 4 5))\n ; ↳ 5\n (length '(1 2 3 4 . 5)) ; improper list\n ; ‼ type error: expected cons, got fixnum: 5\n (length '#0=(1 . #0#)) ; circular list\n ; ↳ NIL" error "Raise an error exception." *io-err* "Current (default) error output IO stream.\n\nFunctions may use `*io-err*` for error output, which then can be\nredirected to a different IO using `with-bindings`." print-exception "Print the exception in a human-readable form.\n\nExceptions are lists containing various information about the error.\nThey may optionally, as the first element, contain the error location\nof the form `(io row column)`.\n\nExamples:\n\n (def e (list (list *stdin* 3 10) 'type-error 'str 123))\n (print-exception e)\n ; ‼ *stdin*:3:10: type error: expected str, got fixnum: 123" set-top-level-value! "Evaluate the expression and assign the result to the symbol in the top\nlevel (global) environment.\n\nThe use of this function is discouraged. For the usual assignment of\nvalues to names it is recommended instead to use `(def …)` and/or\n`(set! …)`.\n\nExamples:\n\n (let {[abc 2]}\n (set-top-level-value! 'abc 123)\n abc)\n ; ↳ 2\n abc\n ; ↳ 123" load "Read and evaluate expression from the file or IO object.\n\nIf the argument is an IO object it is _not_ closed after the load\nfinishes.\n\nExamples:\n\n (load \"stuff.sl\")" getpid "Return the process ID of the StreetLISP VM within the operating system\nit's running on." keyword? "Return `T` if the argument is a keyword, `NIL` otherwise." aref "Return the sequence element specified by the subscripts. The sequence\ncan be an array, vector, a list. Multi-dimensional sequences\nof variating types are also supported.\n\nExamples:\n\n (def a '((1 #(2 (3)) 4)))\n (aref a 0)\n ; ↳ (1 (2 (3)) 4)\n (aref a 1)\n ; ‼ index 1 out of bounds\n (aref a 0 0)\n ; ↳ 1\n (aref a 0 1 0)\n ; ↳ 2\n (aref a 0 2)\n ; ↳ 4" sym? "Return `T` if `v` is a symbol, `NIL` otherwise." defmacro "Define a new macro.\n\nExamples:\n\n (defmacro (inc! v)\n \"Increments and returns the value.\"\n :doc-group my-cool-macros\n :doc-see my-other-cool-macro\n (if (num? v)\n (1+ v)\n `(set! ,v (1+ ,v))))\n (inc! 1)\n ; ↳ 2\n (set! x 1)\n (inc! x)\n ; ↳ 2\n x\n ; ↳ 2" u64 "Construct a 64-bit unsigned number." int-valued? "Return `T` if `x` is a number and is equal (as in `=`) to an\ninteger value of `x`.\n\nExamples:\n\n (int-valued? -123.0)\n ; ↳ T\n\n (int-valued? -123.1)\n ; ↳ NIL" Instructions "VM instructions mapped to their encoded byte representation." assv "Return a pair of a matching key and the associated value, or `NIL` if\nnone matched. Keys are compared using `eqv?`." bignum "Construct a bignum. As opposed to a fixnum, its value is not limited." copy-vec "Return a copy of the vector with the same elements.\n\nNo copies of the values themselves are created, the original values\nare reused.\n\nExamples:\n\n (def v #vec(1 2 \"three\"))\n (def q (copy-vec v))\n (eq? v q)\n ; ↳ NIL\n (equal? v q)\n ; ↳ T\n (map eq? v q)\n ; ↳ #(T T T)" eqv? "Return `T` if both `a` and `b` are of the same value and primitive\n(leaf) type, `NIL` otherwise. Neither cons cell nor vector are not\nconsidered primitive types as they may define deep structures.\n\nExamples:\n\n (eqv? 0.0 0)\n ; ↳ NIL\n\n (eqv? 0 0)\n ; ↳ T\n\n (def a \"1\")\n (def b \"1\")\n (eqv? a b)\n ; ↳ T\n\n (def a '(1))\n (def b '(1))\n (eqv? a b)\n ; ↳ NIL" +f64-epsilon+ "A smallest positive floating point number such that\n`(+ 1.0 +f64-epsilon+)` is not equal to `1.0`." list "Return a list constructed of the arguments.\n\nExamples:\n\n (list) ; empty list\n ; ↳ NIL\n\n (list 1 2.5 \"a\" 'b)\n ; ↳ (1 2.5 \"a\" b)" __init_globals "Initialize globals that need to be set at load time." +pi+ "Mathematical constant π." revappend "Return list with its elements in reverse order, with `tail` appended\nto its end.\n\nThe original list is copied to construct the reversed version.\n\nExamples:\n\n (def a '(4 5 6))\n (revappend a '(3 2 1))\n ; ↳ (6 5 4 3 2 1)\n a\n ; ↳ (4 5 6)" quote "Leave the expression unevaluated.\n\nShorthand for `(quote expr)`.\n\nExamples:\n\n '(0 1 (+ 2 3)) ; same as (quote (0 1 (+ 2 3)))\n ; ↳ (0 1 (+ 2 3))" nreconc "Return list with its elements in reverse order, with `tail` appended\nto its end.\n\nThe original list may be modified by this function.\n\nExamples:\n\n (def a '(4 5 6))\n (nreconc a '(3 2 1))\n ; ↳ (6 5 4 3 2 1)" defc*r "Define a shorthand for list access using `car` and `cdr`.\n\nExamples:\n\n (defc*r caaaaaaaaddr) ; define the function" (doc92group io) "Files and I/O functionality." s64 "Construct a 64-bit signed number." io-flush "Flush the contents of the output buffer to the underlying IO." assoc "Return a pair of a matching key and the associated value, or `NIL` if\nnone matched. Keys are compared using `equal?`.\n\nExamples:\n\n (def L (assoc-list 'a 0 'b 1))\n (assoc 'b L)\n ; ↳ (b . 1)\n (assoc 'c L)\n ; ↳ NIL" + "Return sum of the arguments or `0` when none specified." cadadr "Shorthand for (car (cdr (car (cdr lst))))." foldr1 "Same as `foldr` but using the first element of the sequence as the\ninitial accumulator.\n\nExamples:\n\n (foldr1 + (iota 10))\n ; ↳ 45" compare "Return -1 if `x` is less than `y`, 0 if equal, and `1` if `y` is\ngreater than `x`.\n\nExamples:\n\n (compare 'a 'b)\n ; ↳ -1\n\n (compare 1 1)\n ; ↳ 0\n\n (compare \"b\" \"a\")\n ; ↳ 1" length "Return the length of the sequence.\n\nString's length is measured in UTF-8 codepoints. For tables the number\nof key-value pairs is returned.\n\nNote: for circular lists the result is `NIL`. A type error exception is\nthrown on improper lists, which are not considered valid sequences.\n\nExamples:\n\n (length \"абвгд\")\n ; ↳ 5\n (length #(abc 123))\n ; ↳ 2\n (length #table(0 a 1 b 2 c))\n ; ↳ 3\n (length (arr 'u32 1 2 3 4))\n ; ↳ 4\n (length '(1 2 3 4 5))\n ; ↳ 5\n (length '(1 2 3 4 . 5)) ; improper list\n ; ‼ type error: expected cons, got fixnum: 5\n (length '#0=(1 . #0#)) ; circular list\n ; ↳ NIL" error "Raise an error exception." *io-err* "Current (default) error output IO stream.\n\nFunctions may use `*io-err*` for error output, which then can be\nredirected to a different IO using `with-bindings`." print-exception "Print the exception in a human-readable form.\n\nExceptions are lists containing various information about the error.\nThey may optionally, as the first element, contain the error location\nof the form `(io row column)`.\n\nExamples:\n\n (def e (list (list *stdin* 3 10) 'type-error 'str 123))\n (print-exception e)\n ; ‼ *stdin*:3:10: type error: expected str, got fixnum: 123" set-top-level-value! "Evaluate the expression and assign the result to the symbol in the top\nlevel (global) environment.\n\nThe use of this function is discouraged. For the usual assignment of\nvalues to names it is recommended instead to use `(def …)` and/or\n`(set! …)`.\n\nExamples:\n\n (let {[abc 2]}\n (set-top-level-value! 'abc 123)\n abc)\n ; ↳ 2\n abc\n ; ↳ 123" load "Read and evaluate expression from the file or IO object.\n\nIf the argument is an IO object it is _not_ closed after the load\nfinishes.\n\nExamples:\n\n (load \"stuff.sl\")" getpid "Return the process ID of the StreetLISP VM within the operating system\nit's running on." keyword? "Return `T` if the argument is a keyword, `NIL` otherwise." aref "Return the sequence element specified by the subscripts. The sequence\ncan be an array, vector, a list. Multi-dimensional sequences\nof variating types are also supported.\n\nExamples:\n\n (def a '((1 #(2 (3)) 4)))\n (aref a 0)\n ; ↳ (1 (2 (3)) 4)\n (aref a 1)\n ; ‼ index 1 out of bounds\n (aref a 0 0)\n ; ↳ 1\n (aref a 0 1 0)\n ; ↳ 2\n (aref a 0 2)\n ; ↳ 4" sym? "Return `T` if `v` is a symbol, `NIL` otherwise." defmacro "Define a new macro.\n\nExamples:\n\n (defmacro (inc! v)\n \"Increments and returns the value.\"\n :doc-group my-cool-macros\n :doc-see my-other-cool-macro\n (if (num? v)\n (1+ v)\n `(set! ,v (1+ ,v))))\n (inc! 1)\n ; ↳ 2\n (set! x 1)\n (inc! x)\n ; ↳ 2\n x\n ; ↳ 2" u64 "Construct a 64-bit unsigned number." int-valued? "Return `T` if `x` is a number and is equal (as in `=`) to an\ninteger value of `x`.\n\nExamples:\n\n (int-valued? -123.0)\n ; ↳ T\n\n (int-valued? -123.1)\n ; ↳ NIL" Instructions "VM instructions mapped to their encoded byte representation." assv "Return a pair of a matching key and the associated value, or `NIL` if\nnone matched. Keys are compared using `eqv?`." bignum "Construct a bignum. As opposed to a fixnum, its value is not limited." copy-vec "Return a copy of the vector with the same elements.\n\nNo copies of the values themselves are created, the original values\nare reused.\n\nExamples:\n\n (def v #vec(1 2 \"three\"))\n (def q (copy-vec v))\n (eq? v q)\n ; ↳ NIL\n (equal? v q)\n ; ↳ T\n (map eq? v q)\n ; ↳ #(T T T)" eqv? "Return `T` if both `a` and `b` are of the same value and primitive\n(leaf) type, `NIL` otherwise. Neither cons cell nor vector are not\nconsidered primitive types as they may define deep structures.\n\nExamples:\n\n (eqv? 0.0 0)\n ; ↳ NIL\n\n (eqv? 0 0)\n ; ↳ T\n\n (def a \"1\")\n (def b \"1\")\n (eqv? a b)\n ; ↳ T\n\n (def a '(1))\n (def b '(1))\n (eqv? a b)\n ; ↳ NIL" +f64-epsilon+ "A smallest positive floating point number such that\n`(+ 1.0 +f64-epsilon+)` is not equal to `1.0`." list "Return a list constructed of the arguments.\n\nExamples:\n\n (list) ; empty list\n ; ↳ NIL\n\n (list 1 2.5 \"a\" 'b)\n ; ↳ (1 2.5 \"a\" b)" __init_globals "Initialize globals that need to be set at load time." +pi+ "Mathematical constant π." revappend "Return list with its elements in reverse order, with `tail` appended\nto its end.\n\nThe original list is copied to construct the reversed version.\n\nExamples:\n\n (def a '(4 5 6))\n (revappend a '(3 2 1))\n ; ↳ (6 5 4 3 2 1)\n a\n ; ↳ (4 5 6)" quote "Leave the expression unevaluated.\n\nShorthand for `(quote expr)`.\n\nExamples:\n\n '(0 1 (+ 2 3)) ; same as (quote (0 1 (+ 2 3)))\n ; ↳ (0 1 (+ 2 3))" nreconc "Return list with its elements in reverse order, with `tail` appended\nto its end.\n\nThe original list may be modified by this function.\n\nExamples:\n\n (def a '(4 5 6))\n (nreconc a '(3 2 1))\n ; ↳ (6 5 4 3 2 1)" defc*r "Define a shorthand for list access using `car` and `cdr`.\n\nExamples:\n\n (defc*r caaaaaaaaddr) ; define the function" (doc
92group misc) "Miscellaneous." read-all-of "Return the list containing the values returned by call `(fn io)` repeated\nuntil the IO object runs out of data." cddddr "Shorthand for (cdr (cdr (cdr (cdr lst))))." prog1 "Evaluate the expressions in order, return the result of the first\nexpression.\n\nExamples:\n\n (prog1 (+ 1 2 3)\n (print \"hi\")\n (newline))\n ; ↳ 6" logior "Return the result of bitwise OR (inclusive OR) operation on integers.\n\nExamples:\n\n (logior)\n ; ↳ 0\n\n (logior 2)\n ; ↳ 2\n\n (logior 2 3)\n ; ↳ 3\n\n (logior 2 3 4)\n ; ↳ 7" cadr "Shorthand for `(car (cdr lst))`, that is, _first element of the\nsecond element_.\n\nExamples:\n\n (cadr '(1 2 3))\n ; ↳ 2\n\n (cadr '(1))\n ; ↳ NIL\n\n (cadr NIL)\n ; ↳ NIL" cdadr "Shorthand for (cdr (car (cdr lst)))." (doc93group misc) "Miscellaneous." read-all-of "Return the list containing the values returned by call `(fn io)` repeated\nuntil the IO object runs out of data." cddddr "Shorthand for (cdr (cdr (cdr (cdr lst))))." prog1 "Evaluate the expressions in order, return the result of the first\nexpression.\n\nExamples:\n\n (prog1 (+ 1 2 3)\n (print \"hi\")\n (newline))\n ; ↳ 6" logior "Return the result of bitwise OR (inclusive OR) operation on integers.\n\nExamples:\n\n (logior)\n ; ↳ 0\n\n (logior 2)\n ; ↳ 2\n\n (logior 2 3)\n ; ↳ 3\n\n (logior 2 3 4)\n ; ↳ 7" cadr "Shorthand for `(car (cdr lst))`, that is, _first element of the\nsecond element_.\n\nExamples:\n\n (cadr '(1 2 3))\n ; ↳ 2\n\n (cadr '(1))\n ; ↳ NIL\n\n (cadr NIL)\n ; ↳ NIL" cdadr "Shorthand for (cdr (car (cdr lst)))." (doc
93group doc) "Writing and reading documentation." nan? "Return `T` if `v` is a floating point representation of NaN, either\nnegative or positive, `NIL` otherwise." caar "Shorthand for (car (car lst))." div0 "Return the quotient of the truncated division `a/n`.\n\nExamples:\n\n (div0 10 3)\n ; ↳ 3\n\n (div0 -10 3)\n ; ↳ -3\n\n (div0 -10 -3)\n ; ↳ 3\n\n (div0 10 -3)\n ; ↳ -3" set-syntax! "Associate a macro name with its application function." mod0 "Return the remainder of the truncated division `a/n`.\n\nExamples:\n\n (mod0 10 3)\n ; ↳ 1\n\n (mod0 -10 3)\n ; ↳ -1\n\n (mod0 -10 -3)\n ; ↳ -1\n\n (mod0 10 -3)\n ; ↳ 1" last-pair "Return the last cell (pair) of the list.\n\nExamples:\n\n (last-pair '(1 2 3))\n ; ↳ (3)\n\n (last-pair '(1 2 . 3))\n ; ↳ (2 . 3)" path-cwd "Return the full path to the current directory of the process, or\nchange it to the path specified with `to` argument." (doc94group doc) "Writing and reading documentation." nan? "Return `T` if `v` is a floating point representation of NaN, either\nnegative or positive, `NIL` otherwise." caar "Shorthand for (car (car lst))." div0 "Return the quotient of the truncated division `a/n`.\n\nExamples:\n\n (div0 10 3)\n ; ↳ 3\n\n (div0 -10 3)\n ; ↳ -3\n\n (div0 -10 -3)\n ; ↳ 3\n\n (div0 10 -3)\n ; ↳ -3" set-syntax! "Associate a macro name with its application function." mod0 "Return the remainder of the truncated division `a/n`.\n\nExamples:\n\n (mod0 10 3)\n ; ↳ 1\n\n (mod0 -10 3)\n ; ↳ -1\n\n (mod0 -10 -3)\n ; ↳ -1\n\n (mod0 10 -3)\n ; ↳ 1" last-pair "Return the last cell (pair) of the list.\n\nExamples:\n\n (last-pair '(1 2 3))\n ; ↳ (3)\n\n (last-pair '(1 2 . 3))\n ; ↳ (2 . 3)" path-cwd "Return the full path to the current directory of the process, or\nchange it to the path specified with `to` argument." (doc
94group compress) "Compression." *print-width* "Current maximal visible width (in terminal cells) of strings printed or `NIL`\nif strings are to be printed in full.\n\nTruncation does not occur in the middle of a codepoint or a grapheme cluster.\n\nNote: if a string contains an invalid rune or a control character for which\nits width is undefined, the string is printed in full if the rune in question\nwould fit otherwise.\n\nExamples:\n\n (with-bindings ((*print-width* 3)) (princ \"abcde\"))\n ; ‼ abc...\n\n (with-bindings ((*print-width* 3)) (princ \"ab𲎿\"))\n ; ‼ ab..." arr? "Return `T` if the argument is either a vector or an array, `NIL`\notherwise." cadaar "Shorthand for (car (cdr (car (car lst))))." unwind-protect "Evaluate `expr` first, then `finally`, regardless of whether\nevaluating the former resulted in any exception thrown or not.\n\nIf an exception has been thrown, it will be raised _after_ evaluating\n`finally`, else the result of `expr` is returned.\n\nExamples:\n\n (unwind-protect (begin (print \"a\") (newline)\n (print (/ 1 0)) (newline) ; an error here\n (print \"b\") (newline)\n (begin (print \"c\") (newline))))\n ; ↳ \"a\"\n ; ↳ \"c\"\n ; ‼ /: division by zero" cos "Return the cosine of `r`, where `r` is given in radians." io-skip "Update the current absolute position within the IO object by the\nrelative offset in bytes, return the resulting absolute position.\n\nTo specify the position relative to the end of the file, use the\noptional `:end T` argument with a negative offset.\n\nExamples:\n\n (def f (buffer))\n (io-write f \"hello, world!\")\n (io-skip f -6 :end T)\n ; ↳ 7\n (read f)\n ; ↳ world!" *io-in* "Current (default) input IO stream.\n\nFunctions may use `*io-in*` for input, which then can be redirected\nfrom a different IO using either `with-input-from` or (a more general)\n`with-bindings`." every "Return `T` if the predicate is true for _every_ element of the list,\n`NIL` otherwise.\n\nExample:\n\n ; is every number odd?\n (every odd? '(1 3 5 7))\n ; ↳ T\n\n ; is every string longer than one rune?\n (every (λ (s) (length> s 1))\n '(\"ab\" \"cd\" \"e\"))\n ; ↳ NIL" atom? "Return `T` if `v` is a _not_ a cons cell, `NIL` otherwise. This is\nthe opposite of `cons?`.\n\nThe term \"atom\" comes from the idea of being indivisible.\n\nExamples:\n\n (atom? \"a\")\n ; ↳ T\n\n (atom? NIL)\n ; ↳ T\n\n (atom? '(1))\n ; ↳ NIL" p64 "Construct a 64-bit abstract pointer value." str-utf8? "Return `T` if `s` is a valid UTF-8 string, `NIL` otherwise.\n\nExamples:\n\n (str-utf8? \"привет\")\n ; ↳ T\n\n (str-utf8? \"при\\xffвет\")\n ; ↳ NIL" apply "Return the result of applying a function `f` to a list of arguments.\n\nThe last argument must always be a list which gets spliced as\narguments to the function.\n\nExamples:\n\n (apply + 1 2 '(3 4 5))\n ; ↳ 15\n\n (apply vec '(1 2 3))\n ; ↳ #(3 4 5)\n\n (apply arr 'u8 '(3 4 5))\n ; ↳ #vu8(3 4 5)" cddr "Shorthand for (cdr (cdr lst))." not "Return `T` if `v` is `NIL`, `T` otherwise." print "Print the arguments to *io-out* with `*print-readably*` set to `T`.\n\nMultiple arguments are separated with a single `#\\space`.\n\nExamples:\n\n (print 1 2 \"abc\")\n ; ‼ 1 2 \"abc\"" cdar "Shorthand for (cdr (car lst))." cdaar "Shorthand for (cdr (car (car lst)))." iota "Return a list of generated indices.\n\nThe sequence of numbers generated will contain the elements\n\n (start start+step … start+(count-1)*step)\n\nExamples:\n\n (iota 4)\n ; ↳ (0 1 2 3)\n\n (iota 4 6)\n ; ↳ (6 7 8 9)\n\n (iota 4 6 -0.5)\n ; ↳ (6 5.5 5.0 4.5)" caaddr "Shorthand for (car (car (cdr (cdr lst))))." environment "Return the list of all bound top level symbols." getprop "Return a property value associated with the symbol or `def` if\nmissing.\n\nIf the default value is not supplied and the property is missing,\nan exception will be thrown." (doc95group compress) "Compression." *print-width* "Current maximal visible width (in terminal cells) of strings printed or `NIL`\nif strings are to be printed in full.\n\nTruncation does not occur in the middle of a codepoint or a grapheme cluster.\n\nNote: if a string contains an invalid rune or a control character for which\nits width is undefined, the string is printed in full if the rune in question\nwould fit otherwise.\n\nExamples:\n\n (with-bindings ((*print-width* 3)) (princ \"abcde\"))\n ; ‼ abc...\n\n (with-bindings ((*print-width* 3)) (princ \"ab𲎿\"))\n ; ‼ ab..." arr? "Return `T` if the argument is either a vector or an array, `NIL`\notherwise." cadaar "Shorthand for (car (cdr (car (car lst))))." unwind-protect "Evaluate `expr` first, then `finally`, regardless of whether\nevaluating the former resulted in any exception thrown or not.\n\nIf an exception has been thrown, it will be raised _after_ evaluating\n`finally`, else the result of `expr` is returned.\n\nExamples:\n\n (unwind-protect (begin (print \"a\") (newline)\n (print (/ 1 0)) (newline) ; an error here\n (print \"b\") (newline)\n (begin (print \"c\") (newline))))\n ; ↳ \"a\"\n ; ↳ \"c\"\n ; ‼ /: division by zero" cos "Return the cosine of `r`, where `r` is given in radians." io-skip "Update the current absolute position within the IO object by the\nrelative offset in bytes, return the resulting absolute position.\n\nTo specify the position relative to the end of the file, use the\noptional `:end T` argument with a negative offset.\n\nExamples:\n\n (def f (buffer))\n (io-write f \"hello, world!\")\n (io-skip f -6 :end T)\n ; ↳ 7\n (read f)\n ; ↳ world!" *io-in* "Current (default) input IO stream.\n\nFunctions may use `*io-in*` for input, which then can be redirected\nfrom a different IO using either `with-input-from` or (a more general)\n`with-bindings`." every "Return `T` if the predicate is true for _every_ element of the list,\n`NIL` otherwise.\n\nExample:\n\n ; is every number odd?\n (every odd? '(1 3 5 7))\n ; ↳ T\n\n ; is every string longer than one rune?\n (every (λ (s) (length> s 1))\n '(\"ab\" \"cd\" \"e\"))\n ; ↳ NIL" atom? "Return `T` if `v` is a _not_ a cons cell, `NIL` otherwise. This is\nthe opposite of `cons?`.\n\nThe term \"atom\" comes from the idea of being indivisible.\n\nExamples:\n\n (atom? \"a\")\n ; ↳ T\n\n (atom? NIL)\n ; ↳ T\n\n (atom? '(1))\n ; ↳ NIL" p64 "Construct a 64-bit abstract pointer value." str-utf8? "Return `T` if `s` is a valid UTF-8 string, `NIL` otherwise.\n\nExamples:\n\n (str-utf8? \"привет\")\n ; ↳ T\n\n (str-utf8? \"при\\xffвет\")\n ; ↳ NIL" apply "Return the result of applying a function `f` to a list of arguments.\n\nThe last argument must always be a list which gets spliced as\narguments to the function.\n\nExamples:\n\n (apply + 1 2 '(3 4 5))\n ; ↳ 15\n\n (apply vec '(1 2 3))\n ; ↳ #(3 4 5)\n\n (apply arr 'u8 '(3 4 5))\n ; ↳ #vu8(3 4 5)" cddr "Shorthand for (cdr (cdr lst))." not "Return `T` if `v` is `NIL`, `T` otherwise." print "Print the arguments to *io-out* with `*print-readably*` set to `T`.\n\nMultiple arguments are separated with a single `#\\space`.\n\nExamples:\n\n (print 1 2 \"abc\")\n ; ‼ 1 2 \"abc\"" letrec "Same as the second form of `let` but each of the binding expressions\nmay reference any of the variables bound, before or after.\n\nExamples:\n\n (letrec ((a (λ () 1))\n (b (λ () (+ (c) 1)))\n (c (λ () (+ (a) 1))))\n (list (a) (b) (c)))\n ; ↳ (1 3 2)" cdar "Shorthand for (cdr (car lst))." cdaar "Shorthand for (cdr (car (car lst)))." iota "Return a list of generated indices.\n\nThe sequence of numbers generated will contain the elements\n\n (start start+step … start+(count-1)*step)\n\nExamples:\n\n (iota 4)\n ; ↳ (0 1 2 3)\n\n (iota 4 6)\n ; ↳ (6 7 8 9)\n\n (iota 4 6 -0.5)\n ; ↳ (6 5.5 5.0 4.5)" caaddr "Shorthand for (car (car (cdr (cdr lst))))." environment "Return the list of all bound top level symbols." getprop "Return a property value associated with the symbol or `def` if\nmissing.\n\nIf the default value is not supplied and the property is missing,\nan exception will be thrown." (doc
95group random) "Random numbers generation." T "A boolean \"true\".\n\nExamples:\n\n (not T)\n ; ↳ NIL\n\n (if T 'yes 'no)\n ; ↳ yes" * "Return product of the arguments or `1` when none specified." putprop "Associate a property value with the symbol." *io-out* "Current (default) output IO stream.\n\nFunctions may use `*io-out*` for output, which then can be redirected\nto a different IO using either `with-output-to` or (a more general)\n`with-bindings`." repl "Run interactive prompt in a loop, reading and evaluating the\nexpressions entered by the user and printing the results.\n\nThis function is executed automatically if StreetLISP is started in\ninteractive mode." io-read-until "Return a string by reading from the IO object until encountering the\ndelimiting rune `r`. The returned string includes the delimiter." get "Return the value associated with the `key` in the table.\n\nIf the key isn't in the table then either return the optional\n`failed-result` argument or (if called without the argument) throw a\n`key-error` exception.\n\nExamples:\n\n (def t #table(a 1 b 2))\n (get t 'a)\n ; ↳ 1\n (get t 'b NIL)\n ; ↳ 2\n (get t 'c)\n ; ‼ key not found: a\n (get t 'c 123)\n ; ↳ 123" table? "Return `T` if the argument is a table, `NIL` otherwise." u16 "Construct a 16-bit unsigned number." logxor "Return the result of bitwise XOR (exclusive OR) operation on integers.\n\nExamples:\n\n (logxor)\n ; ↳ 0\n\n (logxor 2)\n ; ↳ 2\n\n (logxor 2 3)\n ; ↳ 1\n\n (logxor 2 3 4)\n ; ↳ 5" str-width "Return the number of columns needed to represent a string or a rune.\n\nIf a non-printable control rune is encountered, the result is `NIL`,\nelse it is a non-negative integer. Rune `#\\null` is considered of width zero.\n\nExamples:\n\n (str-width #\\й)\n ; ↳ 1\n (str-width \"⌛!\")\n ; ↳ 3\n (str-width \"nope\\n\")\n ; ↳ NIL" acos "Return the arc cosine of `x` in radians." time->str "Return the number of nanoseconds since Epoch formatted as time and date.\n\nThis is the opposite of `str->time`.\n\nExamples:\n\n (time->str (time-now))\n ; ↳ \"Tue May 6 03:21:01 CES 2025\"" caddr "Shorthand for (car (cdr (cdr lst)))." to-proper "Return a proper list that is a copy of the original list.\n\nExamples:\n\n (to-proper '(1 2))\n ; ↳ (1 2)\n\n (to-proper '(1 . 2))\n ; ↳ (1 2)" table-keys "Return the list of all keys of the table.\n\nExamples:\n\n (def t #table(a 1 b 2 c 1))\n (table-keys t)\n ; ↳ (a b c)" catch "Evaluate `expr` and catch any exception thrown while evaluating by a\ncall to `throw` with the specified `tag`.\n\nIf no exception was thrown, return the result of the expression. In\ncase an exception thrown has a different tag, raise it further, to be\ncaught on a higher level of exception handling logic." __start "The system boot image entry.\n\nThis is the first function executed by the VM after initialization." NIL "An empty list. Can be used as the opposite of T in boolean\nexpressions.\n\nExamples:\n\n (not NIL)\n ; ↳ T\n\n (if NIL 'yes 'no)\n ; ↳ no\n\n (car NIL)\n ; ↳ NIL\n\n (cdr NIL)\n ; ↳ NIL" floor "Return the largest integer that is less than or equal to `x`.\n\nInfinity and NaN `floor` to themselves.\n\nExamples:\n\n (floor 1.2)\n ; ↳ 1.0\n\n (floor -1.2)\n ; ↳ -2.0\n\n (floor -5)\n ; ↳ -5.0" add-exit-hook "Puts an one-argument function on top of the list of exit hooks.\n\nOn shutdown each exit hook is called with the exit status as a single\nargument, which is (usually) `NIL` on success and a string describing\nan error otherwise.\n\nThe hook added last will be called first." str-join "Return concatenated elements of `strlist`, separated between each\nother with `sep`, as a single string.\n\nThe separator can be of any type suitable for `io-write` - a rune,\nstring, array of C primitives.\n\nExamples:\n\n (str-join '(\"\" \"n\" \"9\" \"heh\")\n *directory-separator*)\n ; ↳ \"/n/9/heh\"\n\n (str-join '(\"a\" \"b\" \"c\") #\\.)\n ; ↳ \"a.b.c\"" (doc96group random) "Random numbers generation." T "A boolean \"true\".\n\nExamples:\n\n (not T)\n ; ↳ NIL\n\n (if T 'yes 'no)\n ; ↳ yes" * "Return product of the arguments or `1` when none specified." putprop "Associate a property value with the symbol." *io-out* "Current (default) output IO stream.\n\nFunctions may use `*io-out*` for output, which then can be redirected\nto a different IO using either `with-output-to` or (a more general)\n`with-bindings`." repl "Run interactive prompt in a loop, reading and evaluating the\nexpressions entered by the user and printing the results.\n\nThis function is executed automatically if StreetLISP is started in\ninteractive mode." io-read-until "Return a string by reading from the IO object until encountering the\ndelimiting rune `r`. The returned string includes the delimiter." get "Return the value associated with the `key` in the table.\n\nIf the key isn't in the table then either return the optional\n`failed-result` argument or (if called without the argument) throw a\n`key-error` exception.\n\nExamples:\n\n (def t #table(a 1 b 2))\n (get t 'a)\n ; ↳ 1\n (get t 'b NIL)\n ; ↳ 2\n (get t 'c)\n ; ‼ key not found: a\n (get t 'c 123)\n ; ↳ 123" table? "Return `T` if the argument is a table, `NIL` otherwise." u16 "Construct a 16-bit unsigned number." logxor "Return the result of bitwise XOR (exclusive OR) operation on integers.\n\nExamples:\n\n (logxor)\n ; ↳ 0\n\n (logxor 2)\n ; ↳ 2\n\n (logxor 2 3)\n ; ↳ 1\n\n (logxor 2 3 4)\n ; ↳ 5" str-width "Return the number of columns needed to represent a string or a rune.\n\nIf a non-printable control rune is encountered, the result is `NIL`,\nelse it is a non-negative integer. Rune `#\\null` is considered of width zero.\n\nExamples:\n\n (str-width #\\й)\n ; ↳ 1\n (str-width \"⌛!\")\n ; ↳ 3\n (str-width \"nope\\n\")\n ; ↳ NIL" acos "Return the arc cosine of `x` in radians." time->str "Return the number of nanoseconds since Epoch formatted as time and date.\n\nThis is the opposite of `str->time`.\n\nExamples:\n\n (time->str (time-now))\n ; ↳ \"Tue May 6 03:21:01 CES 2025\"" caddr "Shorthand for (car (cdr (cdr lst)))." to-proper "Return a proper list that is a copy of the original list.\n\nExamples:\n\n (to-proper '(1 2))\n ; ↳ (1 2)\n\n (to-proper '(1 . 2))\n ; ↳ (1 2)" table-keys "Return the list of all keys of the table.\n\nExamples:\n\n (def t #table(a 1 b 2 c 1))\n (table-keys t)\n ; ↳ (a b c)" catch "Evaluate `expr` and catch any exception thrown while evaluating by a\ncall to `throw` with the specified `tag`.\n\nIf no exception was thrown, return the result of the expression. In\ncase an exception thrown has a different tag, raise it further, to be\ncaught on a higher level of exception handling logic." __start "The system boot image entry.\n\nThis is the first function executed by the VM after initialization." NIL "An empty list. Can be used as the opposite of T in boolean\nexpressions.\n\nExamples:\n\n (not NIL)\n ; ↳ T\n\n (if NIL 'yes 'no)\n ; ↳ no\n\n (car NIL)\n ; ↳ NIL\n\n (cdr NIL)\n ; ↳ NIL" floor "Return the largest integer that is less than or equal to `x`.\n\nInfinity and NaN `floor` to themselves.\n\nExamples:\n\n (floor 1.2)\n ; ↳ 1.0\n\n (floor -1.2)\n ; ↳ -2.0\n\n (floor -5)\n ; ↳ -5.0" add-exit-hook "Puts an one-argument function on top of the list of exit hooks.\n\nOn shutdown each exit hook is called with the exit status as a single\nargument, which is (usually) `NIL` on success and a string describing\nan error otherwise.\n\nThe hook added last will be called first." str-join "Return concatenated elements of `strlist`, separated between each\nother with `sep`, as a single string.\n\nThe separator can be of any type suitable for `io-write` - a rune,\nstring, array of C primitives.\n\nExamples:\n\n (str-join '(\"\" \"n\" \"9\" \"heh\")\n *directory-separator*)\n ; ↳ \"/n/9/heh\"\n\n (str-join '(\"a\" \"b\" \"c\") #\\.)\n ; ↳ \"a.b.c\"" (doc
96group sys) "OS-specific functions." >= "Return `T` if the arguments are in non-increasing order (previous\none is greater than or equal to the next one)." +f32-epsilon+ "A smallest positive floating point number such that\n`(+ 1.0f +f32-epsilon+)` is not equal to `1.0f`." lognot "Return the result of bitwise NOT (complement) operation on an integer.\n\nExamples:\n\n (lognot 0)\n ; ↳ -1\n\n (lognot #s8(63))\n ; ↳ #s8(-64)\n\n (lognot #u16(32767))\n ; ↳ #u16(32768)" void? "Return `T` if `v` is `#<void>`, `NIL` otherwise." length= "Perform a bounded length test and return `T` if the length is `n`,\n`NIL` otherwise.\n\nUse this instead of `(= (length seq) n)`, since it avoids unnecessary\nwork and always terminates.\n\nThe value of `seq` can be of any sequence type." int? "Return `T` if the argument is an integer, `NIL` otherwise." nanoseconds-monotonic "Return the number of nanoseconds passed since the first call to this\nfunction.\n\nThe first call will always return 0.\n\nExamples:\n\n (nanoseconds-monotonic)\n ; ↳ #u64(0)\n (nanoseconds-monotonic)\n ; ↳ #u64(47840)" io-discard-buffer "Discard the contents of the output buffer of the writable IO." with-input-from "Evaluate expressions in `body` with `*io-in*` set to `io` during the\nevaluation.\n\nExamples:\n\n ; read a single expression from a file\n ; and print it\n (with-output-to (file \"/tmp/1.txt\" :read)\n (print (read *io-in*))\n (newline))" *stdout* "Standard output IO stream." car "Return the first element of a cons cell (head of a list) or `NIL` if\nnot available.\n\nExamples:\n\n (car NIL)\n ; ↳ NIL\n\n (car '(1 2 3))\n ; ↳ 1\n\n (car '(1 . 2))\n ; ↳ 1" ceiling "Return the smallest integer that is greater than or equal to `x`.\n\nInfinity and NaN `ceiling` to themselves.\n\nExamples:\n\n (ceiling 1.2)\n ; ↳ 2.0\n\n (ceiling -1.2)\n ; ↳ -1.0\n\n (ceiling -5)\n ; ↳ -5.0" arr "Construct a packed array containing the specified arguments.\n\nThe arguments will be coerced to a single `type` which must be\na fixed-width number or pointer type, or rune.\n\nExamples:\n\n (arr 's8 0 1 2)\n ; ↳ #arr(s8 0 1 2)\n\n (arr 'rune 0 1 2)\n ; ↳ #arr(rune #\\nul #\\soh #\\stx)" <= "Return `T` if the arguments are in non-decreasing order (previous\none is less than or equal to the next one)." length> "Perform a bounded length test and return `T` if the length is greater\nthan `n`, `NIL` otherwise.\n\nUse this instead of `(> (length seq) n)`, since it avoids unnecessary\nwork and always terminates.\n\nThe value of `seq` can be of any sequence type." arg-error "Raise an argument error exception." asin "Return the arc sine of `x` in radians." put! "Store the value associated with the key and return the table.\n\nAny existing value associated with the key will be replaced.\n\nExamples:\n\n (def t #table(a 1 b 2))\n (put! t 'c 3)\n ; ↳ #table(c 3 b 2 a 1)\n (put! t 'a \"hello\")\n ; ↳ #table(c 3 b 2 a \"hello\")" log "Return the logarithm of `x` in `base`.\n\nDefault base is `e`, returning natural logarithm of the first\nargument.\n\nExamples:\n\n (log 100 10)\n ; ↳ 2.0\n\n (log 256 2)\n ; ↳ 8.0\n\n (log (exp 4))\n ; ↳ 4.0" (doc97group sys) "OS-specific functions." >= "Return `T` if the arguments are in non-increasing order (previous\none is greater than or equal to the next one)." +f32-epsilon+ "A smallest positive floating point number such that\n`(+ 1.0f +f32-epsilon+)` is not equal to `1.0f`." lognot "Return the result of bitwise NOT (complement) operation on an integer.\n\nExamples:\n\n (lognot 0)\n ; ↳ -1\n\n (lognot #s8(63))\n ; ↳ #s8(-64)\n\n (lognot #u16(32767))\n ; ↳ #u16(32768)" void? "Return `T` if `v` is `#<void>`, `NIL` otherwise." length= "Perform a bounded length test and return `T` if the length is `n`,\n`NIL` otherwise.\n\nUse this instead of `(= (length seq) n)`, since it avoids unnecessary\nwork and always terminates.\n\nThe value of `seq` can be of any sequence type." int? "Return `T` if the argument is an integer, `NIL` otherwise." nanoseconds-monotonic "Return the number of nanoseconds passed since the first call to this\nfunction.\n\nThe first call will always return 0.\n\nExamples:\n\n (nanoseconds-monotonic)\n ; ↳ #u64(0)\n (nanoseconds-monotonic)\n ; ↳ #u64(47840)" io-discard-buffer "Discard the contents of the output buffer of the writable IO." with-input-from "Evaluate expressions in `body` with `*io-in*` set to `io` during the\nevaluation.\n\nExamples:\n\n ; read a single expression from a file\n ; and print it\n (with-output-to (file \"/tmp/1.txt\" :read)\n (print (read *io-in*))\n (newline))" *stdout* "Standard output IO stream." car "Return the first element of a cons cell (head of a list) or `NIL` if\nnot available.\n\nExamples:\n\n (car NIL)\n ; ↳ NIL\n\n (car '(1 2 3))\n ; ↳ 1\n\n (car '(1 . 2))\n ; ↳ 1" ceiling "Return the smallest integer that is greater than or equal to `x`.\n\nInfinity and NaN `ceiling` to themselves.\n\nExamples:\n\n (ceiling 1.2)\n ; ↳ 2.0\n\n (ceiling -1.2)\n ; ↳ -1.0\n\n (ceiling -5)\n ; ↳ -5.0" arr "Construct a packed array containing the specified arguments.\n\nThe arguments will be coerced to a single `type` which must be\na fixed-width number or pointer type, or rune.\n\nExamples:\n\n (arr 's8 0 1 2)\n ; ↳ #arr(s8 0 1 2)\n\n (arr 'rune 0 1 2)\n ; ↳ #arr(rune #\\nul #\\soh #\\stx)" <= "Return `T` if the arguments are in non-decreasing order (previous\none is less than or equal to the next one)." length> "Perform a bounded length test and return `T` if the length is greater\nthan `n`, `NIL` otherwise.\n\nUse this instead of `(> (length seq) n)`, since it avoids unnecessary\nwork and always terminates.\n\nThe value of `seq` can be of any sequence type." arg-error "Raise an argument error exception." asin "Return the arc sine of `x` in radians." put! "Store the value associated with the key and return the table.\n\nAny existing value associated with the key will be replaced.\n\nExamples:\n\n (def t #table(a 1 b 2))\n (put! t 'c 3)\n ; ↳ #table(c 3 b 2 a 1)\n (put! t 'a \"hello\")\n ; ↳ #table(c 3 b 2 a \"hello\")" log "Return the logarithm of `x` in `base`.\n\nDefault base is `e`, returning natural logarithm of the first\nargument.\n\nExamples:\n\n (log 100 10)\n ; ↳ 2.0\n\n (log 256 2)\n ; ↳ 8.0\n\n (log (exp 4))\n ; ↳ 4.0" (doc
97group number) "Operations on numbers, mathematical constants." cdaddr "Shorthand for (cdr (car (cdr (cdr lst))))." ash "Return the integer shifted by the specified number of bits to the\nright (negative `nbits`) or left (positive `nbits`).\n\nExamples:\n\n (ash -3 3)\n ; ↳ -24\n\n (ash 1 3)\n ; ↳ 8" str-sub "Return the portion of the string within the specified bounds.\n\nThe `start` and `end` index by rune. Specifying any index out of bounds\nof the string will result in an exception thrown.\n\nIf `end` isn't specified the portion is assumed to begin at `start`\nuntil the end of the original string.\n\nExamples:\n\n (str-sub \"hello\" 2)\n ; ↳ \"llo\"\n\n (str-sub \"hello\" 3 3)\n ; ↳ \"\"\n\n (str-sub \"hello\" 2 4)\n ; ↳ \"ll\"" vec-alloc "Construct a vector of the specified `length` by repeating\nthe elements in `rest`.\n\nExamples:\n\n (vec-alloc 5 2.5)\n ; ↳ #(2.5 2.5 2.5 2.5 2.5)\n\n (vec-alloc 10 1 2.5 \"a\" 'b)\n ; ↳ #(1 2.5 \"a\" b 1 2.5 \"a\" b 1 2.5)" arr-alloc "Construct a packed array of the specified `length` by repeating\nthe elements in `rest`.\n\nThe arguments will be coerced to a single `type` which must be\na fixed-width number or pointer type, or rune.\n\nExamples:\n\n (arr-alloc 'u16 5 -1)\n ; ↳ #arr(u16 65535 65535 65535 65535 65535)\n\n (arr-alloc 's8 10 0 1 2)\n ; ↳ #arr(s8 0 1 2 0 1 2 0 1 2 0)" cddadr "Shorthand for (cdr (cdr (car (cdr lst))))." memv "Return the tail of a list beginning with the item, or `NIL` otherwise.\nList elements are compared to the `item` using `eqv?`." max "Return the largest among the arguments.\n\nExamples:\n\n (max 3 1 9 4)\n ; ↳ 9\n\n (max 'c 'h 'z 'a)\n ; ↳ z\n\n (max \"t\" \"g\" \"a\")\n ; ↳ \"t\"" closure? "Return `T` if the argument is a function that is implemented in LISP\n(as opposed to a C builtin), `NIL` otherwise.\n\nExamples:\n\n (closure? closure?)\n ; ↳ T\n\n (closure? length)\n ; ↳ NIL" read-all "Return a list of terms read from the IO object until it ran out of\ndata.\n\nExamples:\n\n ; read current process' status file on Plan 9\n (def status (file (str \"/proc/\" (getpid) \"/status\")))\n (read-all status)\n ; ↳ (sl glenda Pread 40 0 4940 0 0 0 1856 10 10)" help-print-header "Format and print signature(s) of the term for `(help term)` output." arg-counts "VM instructions mapped to their expected arguments count." sleep "Halt the StreetLISP VM for the specified duration of time in seconds.\n\nExamples:\n\n (sleep 0.1) ; sleep for 100ms" s16 "Construct a 16-bit signed number." rune? "Return `T` if the value is a rune, `NIL` otherwise." os-setenv "Add or replace the value of the environment variable `name` to\n`value`.\n\nIf `value` is `NIL`, the variable is deleted from the environment if\nit exists." __script "Execute a single file at `path`.\n\nAn unhandled exception will result in it being printed to `*io-err*`\nand the process exiting with a non-zero (non-empty in case OS is Plan\n9) status signaling an error to its parent.") *doc-extra* #table(append ((:doc-group . list)98group number) "Operations on numbers, mathematical constants." cdaddr "Shorthand for (cdr (car (cdr (cdr lst))))." ash "Return the integer shifted by the specified number of bits to the\nright (negative `nbits`) or left (positive `nbits`).\n\nExamples:\n\n (ash -3 3)\n ; ↳ -24\n\n (ash 1 3)\n ; ↳ 8" str-sub "Return the portion of the string within the specified bounds.\n\nThe `start` and `end` index by rune. Specifying any index out of bounds\nof the string will result in an exception thrown.\n\nIf `end` isn't specified the portion is assumed to begin at `start`\nuntil the end of the original string.\n\nExamples:\n\n (str-sub \"hello\" 2)\n ; ↳ \"llo\"\n\n (str-sub \"hello\" 3 3)\n ; ↳ \"\"\n\n (str-sub \"hello\" 2 4)\n ; ↳ \"ll\"" vec-alloc "Construct a vector of the specified `length` by repeating\nthe elements in `rest`.\n\nExamples:\n\n (vec-alloc 5 2.5)\n ; ↳ #(2.5 2.5 2.5 2.5 2.5)\n\n (vec-alloc 10 1 2.5 \"a\" 'b)\n ; ↳ #(1 2.5 \"a\" b 1 2.5 \"a\" b 1 2.5)" arr-alloc "Construct a packed array of the specified `length` by repeating\nthe elements in `rest`.\n\nThe arguments will be coerced to a single `type` which must be\na fixed-width number or pointer type, or rune.\n\nExamples:\n\n (arr-alloc 'u16 5 -1)\n ; ↳ #arr(u16 65535 65535 65535 65535 65535)\n\n (arr-alloc 's8 10 0 1 2)\n ; ↳ #arr(s8 0 1 2 0 1 2 0 1 2 0)" cddadr "Shorthand for (cdr (cdr (car (cdr lst))))." memv "Return the tail of a list beginning with the item, or `NIL` otherwise.\nList elements are compared to the `item` using `eqv?`." max "Return the largest among the arguments.\n\nExamples:\n\n (max 3 1 9 4)\n ; ↳ 9\n\n (max 'c 'h 'z 'a)\n ; ↳ z\n\n (max \"t\" \"g\" \"a\")\n ; ↳ \"t\"" closure? "Return `T` if the argument is a function that is implemented in LISP\n(as opposed to a C builtin), `NIL` otherwise.\n\nExamples:\n\n (closure? closure?)\n ; ↳ T\n\n (closure? length)\n ; ↳ NIL" read-all "Return a list of terms read from the IO object until it ran out of\ndata.\n\nExamples:\n\n ; read current process' status file on Plan 9\n (def status (file (str \"/proc/\" (getpid) \"/status\")))\n (read-all status)\n ; ↳ (sl glenda Pread 40 0 4940 0 0 0 1856 10 10)" help-print-header "Format and print signature(s) of the term for `(help term)` output." arg-counts "VM instructions mapped to their expected arguments count." sleep "Halt the StreetLISP VM for the specified duration of time in seconds.\n\nExamples:\n\n (sleep 0.1) ; sleep for 100ms" s16 "Construct a 16-bit signed number." rune? "Return `T` if the value is a rune, `NIL` otherwise." os-setenv "Add or replace the value of the environment variable `name` to\n`value`.\n\nIf `value` is `NIL`, the variable is deleted from the environment if\nit exists." __script "Execute a single file at `path`.\n\nAn unhandled exception will result in it being printed to `*io-err*`\nand the process exiting with a non-zero (non-empty in case OS is Plan\n9) status signaling an error to its parent.") *doc-extra* #table(append ((:doc-group . list)
@@ -130,10 +131,11 @@ group number) "Operations on numbers, mathematical constants." cdaddr "Shorthan · 32 unmodified lines
130(:doc-see . s32)) cons ((:doc-group . list) (:doc-see . cons?) (:doc-see . list) (:doc-group . builtin)) filter ((:doc-group . list)131(:doc-see . s32)) cons ((:doc-group . list) (:doc-see . cons?) (:doc-see . list) (:doc-group . builtin)) filter ((:doc-group . list)
131(:doc-see . partition)) make-random-state ((:doc-group . random) (:doc-see . *random-state*) (:doc-see . random-state?)132(:doc-see . partition)) make-random-state ((:doc-group . random) (:doc-see . *random-state*) (:doc-see . random-state?)
132(:doc-see . random)) assq ((:doc-group . list)133(:doc-see . random)) assq ((:doc-group . list)
133(:doc-see . assoc) (:doc-see . assv)) io-buffer-mode! ((:doc-group . io) (:doc-see . io-buffer-mode)) del! ((:doc-group . table)134(:doc-see . assoc) (:doc-see . assv)) io-buffer-mode! ((:doc-group . io) (:doc-see . io-buffer-mode)) let ((:doc-group . syntax)
134(:doc-see . has?) (:doc-see . get) (:doc-see . put!)) when ((:doc-group . syntax) (:doc-see . unless)135(:doc-see . let*) (:doc-see . letrec)) del! ((:doc-group . table) (:doc-see . has?) (:doc-see . get)
135(:doc-see . if)) vec? ((:doc-group . type)136(:doc-see . put!)) when ((:doc-group . syntax)
136(:doc-group . builtin)) min ((:doc-group . compare) (:doc-see . max)) cddaar ((:doc-group . list)) num->str ((:doc-group . string)) io? ((:doc-group . io)137(:doc-see . unless) (:doc-see . if)) vec? ((:doc-group . type) (:doc-group . builtin)) min ((:doc-group . compare)
138(:doc-see . max)) cddaar ((:doc-group . list)) num->str ((:doc-group . string)) io? ((:doc-group . io)
137(:doc-group . type)) eof-object? ((:doc-group . io) (:doc-group . type)) help ((:doc-group . doc)) mod ((:doc-group . number)139(:doc-group . type)) eof-object? ((:doc-group . io) (:doc-group . type)) help ((:doc-group . doc)) mod ((:doc-group . number)
138(:doc-see . div) (:doc-see . mod0)) if ((:doc-group . syntax) (:doc-see . when) (:doc-see . unless)) p32 ((:doc-group . number)140(:doc-see . div) (:doc-see . mod0)) if ((:doc-group . syntax) (:doc-see . when) (:doc-see . unless)) p32 ((:doc-group . number)
139(:doc-see . p64) (:doc-see . ptr)) io-read-lines ((:doc-group . io) (:doc-see . io-read-line) (:doc-see . io-read-all)) io-line ((:doc-group . io)141(:doc-see . p64) (:doc-see . ptr)) io-read-lines ((:doc-group . io) (:doc-see . io-read-line) (:doc-see . io-read-all)) io-line ((:doc-group . io)
@@ -187,7 +189,8 @@ group number) "Operations on numbers, mathematical constants." cdaddr "Shorthan · 47 unmodified lines
187(:doc-see . io-read)) table-invert ((:doc-group . table) (:doc-see . table-values)) lz-unpack ((:doc-group . compress)) div ((:doc-group . number)189(:doc-see . io-read)) table-invert ((:doc-group . table) (:doc-see . table-values)) lz-unpack ((:doc-group . compress)) div ((:doc-group . number)
188(:doc-see . mod) (:doc-see . div0)) princ ((:doc-group . io) (:doc-see . print)) last-cdr ((:doc-group . list)190(:doc-see . mod) (:doc-see . div0)) princ ((:doc-group . io) (:doc-see . print)) last-cdr ((:doc-group . list)
189(:doc-see . last-pair)) trace ((:doc-group . debug) (:doc-see . untrace) (:doc-see . traced?)) io-filename ((:doc-group . io)191(:doc-see . last-pair)) trace ((:doc-group . debug) (:doc-see . untrace) (:doc-see . traced?)) io-filename ((:doc-group . io)
190(:doc-see . io-filename!)) gensym? ((:doc-group . type) (:doc-see . sym?) (:doc-see . sym)) defdoc ((:doc-group . doc)) cdddr ((:doc-group . list)) copy-table ((:doc-group . table)192(:doc-see . io-filename!)) let* ((:doc-group . syntax) (:doc-see . let) (:doc-see . letrec)) gensym? ((:doc-group . type)
193(:doc-see . sym?) (:doc-see . sym)) defdoc ((:doc-group . doc)) cdddr ((:doc-group . list)) copy-table ((:doc-group . table)
191(:doc-see . table->assoc-list)) set-car! ((:doc-group . list) (:doc-group . builtin)) partition ((:doc-group . list)194(:doc-see . table->assoc-list)) set-car! ((:doc-group . list) (:doc-group . builtin)) partition ((:doc-group . list)
192(:doc-see . filter)) has? ((:doc-group . table) (:doc-see . get) (:doc-see . put!) (:doc-see . del!)) vec ((:doc-group . array)195(:doc-see . filter)) has? ((:doc-group . table) (:doc-see . get) (:doc-see . put!) (:doc-see . del!)) vec ((:doc-group . array)
193(:doc-see . vec-alloc) (:doc-see . arr) (:doc-group . builtin)) while ((:doc-group . syntax) (:doc-see . for)) rune ((:doc-group . string)196(:doc-see . vec-alloc) (:doc-see . arr) (:doc-group . builtin)) while ((:doc-group . syntax) (:doc-see . for)) rune ((:doc-group . string)
@@ -237,9 +240,9 @@ group number) "Operations on numbers, mathematical constants." cdaddr "Shorthan · 43 unmodified lines
237(:doc-see . and)240(:doc-see . and)
238(:doc-see . or)241(:doc-see . or)
239(:doc-group . builtin)) print ((:doc-group . io)242(:doc-group . builtin)) print ((:doc-group . io)
240(:doc-see . princ)) cdar ((:doc-group . list)) cdaar ((:doc-group . list)) iota ((:doc-group . list)243(:doc-see . princ)) letrec ((:doc-group . syntax) (:doc-see . let) (:doc-see . let*)) cdar ((:doc-group . list)) cdaar ((:doc-group . list)) iota ((:doc-group . list)
241(:doc-see . map-int)) caaddr ((:doc-group . list)) environment ((:doc-group . debug)244(:doc-see . map-int)) caaddr ((:doc-group . list)) environment ((:doc-group . debug) (:doc-group . vm)
242(:doc-group . vm) (:doc-see . print-stack-trace)) getprop ((:doc-group . prop) (:doc-see . putprop)) putprop ((:doc-group . prop)245(:doc-see . print-stack-trace)) getprop ((:doc-group . prop) (:doc-see . putprop)) putprop ((:doc-group . prop)
243(:doc-see . getprop)) T ((:doc-see)) * ((:doc-group . number) (:doc-group . builtin)) *io-out* ((:doc-group . io)246(:doc-see . getprop)) T ((:doc-see)) * ((:doc-group . number) (:doc-group . builtin)) *io-out* ((:doc-group . io)
244(:doc-see . *io-err*) (:doc-see . *io-in*) (:doc-see . with-output-to)) repl ((:doc-group . vm)247(:doc-see . *io-err*) (:doc-see . *io-in*) (:doc-see . with-output-to)) repl ((:doc-group . vm)
245(:doc-see . that)248(:doc-see . that)
src/system.sl+51−0
@@ -1961,6 +1961,19 @@ · 1960 unmodified lines
1961 (list '$trycatch try catch))1961 (list '$trycatch try catch))
1962 1962
1963(defmacro (letrec binds . body)1963(defmacro (letrec binds . body)
1964 «Same as the second form of `let` but each of the binding expressions
1965 may reference any of the variables bound, before or after.
1966
1967 Examples:
1968
1969 (letrec ((a (λ () 1))
1970 (b (λ () (+ (c) 1)))
1971 (c (λ () (+ (a) 1))))
1972 (list (a) (b) (c)))
1973 ; ↳ (1 3 2)»
1974 :doc-group syntax
1975 :doc-see let
1976 :doc-see let*
1964 (unless (cons? body)1977 (unless (cons? body)
1965 (arg-error "missing body"))1978 (arg-error "missing body"))
1966 `((λ ,(map car binds)1979 `((λ ,(map car binds)
@@ -1969,6 +1982,19 @@ · 2 unmodified lines
1969 ,.(map void binds)))1982 ,.(map void binds)))
1970 1983
1971(defmacro (let* binds . body)1984(defmacro (let* binds . body)
1985 «Same as the second form of `let` but each of the binding expressions
1986 may reference any of the varibles bound previously.
1987
1988 Examples:
1989
1990 (let* ((a 1)
1991 (b (+ a 1))
1992 (c (+ b 1)))
1993 c)
1994 ; ↳ 3»
1995 :doc-group syntax
1996 :doc-see let
1997 :doc-see letrec
1972 (unless (cons? body)1998 (unless (cons? body)
1973 (arg-error "missing body"))1999 (arg-error "missing body"))
1974 `((λ (,(caar binds))2000 `((λ (,(caar binds))
@@ -1978,6 +2004,29 @@ · 3 unmodified lines
1978 ,(aref binds 0 1)))2004 ,(aref binds 0 1)))
1979 2005
1980(defmacro (let binds . body)2006(defmacro (let binds . body)
2007 «Bind variables and execute a series of expression that use
2008 these bindings, return the result of the last expression.
2009
2010 The first form `(let id ((… ) …) …)`, which is called
2011 "named let", allows referencing the resulting lambda within
2012 the expressions following the bindings to aid with recursive
2013 calls.
2014
2015 Examples:
2016
2017 (let loop ((a (iota 3 1))) ; first form
2018 (when a
2019 (princ (car a))
2020 (loop (cdr a))))
2021 ; ‼ 123
2022 ; ↳ NIL
2023
2024 (let ((a 123) (b 456)) ; second form
2025 (+ a b))
2026 ; ↳ 579»
2027 :doc-group syntax
2028 :doc-see let*
2029 :doc-see letrec
1981 (unless (cons? body)2030 (unless (cons? body)
1982 (arg-error "missing body"))2031 (arg-error "missing body"))
1983 (let ((lname NIL))2032 (let ((lname NIL))
@@ -2004,6 +2053,8 @@ · 20 unmodified lines
2004 thelambda)2053 thelambda)
2005 theargs))))2054 theargs))))
2006 2055
2056(defdoc (let id binds . body))
2057
2007(defmacro (cond . clauses)2058(defmacro (cond . clauses)
2008 (def (1arg-lambda? func)2059 (def (1arg-lambda? func)
2009 (and (cons? func)2060 (and (cons? func)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t