ref: 860c0fe83c8442c30e1a8df1a64f5c3016885784
parent: f4eca39822c7c76bd36b15dcfaf2a8641cffa9f5
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sun May 25 14:09:07 EDT 2025
io: change things up Remove io-seek, instead use io-pos with an optional second argument. Add (:end NIL) to io-skip to seek from the end of the file. Return absolute position where possible.
--- a/boot/sl.boot
+++ b/boot/sl.boot
@@ -25,8 +25,8 @@
index . msg)) even? ((n)) zero? ((n)) proper-list? ((v)) random ((max)) reverse! ((lst)) eval ((x)) cdaadr ((lst)) u32 (((n
0))) cons ((first second)) filter ((pred lst)) assq ((key lst)) del! ((table key)) when ((cond . body)) vec? ((v)) min ((v . rest)) cddaar ((lst)) num->str ((n
(:base 10))) io? ((term)) eof-object? ((v)) help ((topic (:print-header help-print-header) . rest)) mod ((a
-n)) if ((cond then else)) p32 (((n 0))) io-read-lines ((io)) sym-set-doc ((symbol doc-seq . formals-list)) macrocall? ((e)) trycatch ((try
-catch)) table-values ((ta)) macroexpand ((e)) caadr ((lst)) type-of ((v)) top-level-value ((sym)) defstruct ((name
+n)) if ((cond then else)) p32 (((n 0))) io-read-lines ((io)) io-line ((io (new-line NIL))) sym-set-doc ((symbol
+doc-seq . formals-list)) macrocall? ((e)) trycatch ((try catch)) table-values ((ta)) macroexpand ((e)) caadr ((lst)) type-of ((v)) top-level-value ((sym)) defstruct ((name
docs… options… (slot-1 DEFAULT) slot-2 slot-3)
(name (:type vec) (:named T) (:constructor T) (:conc-name T) (:predicate T) . slots)) caadar ((lst)) buffer (NIL) assoc-list (kvs) builtin? ((v)) str-map ((fn
s)) macroexpand-1 ((e)) str (terms) negative? ((n)) void (rest) assert-fail ((expr . what)) io-read-line ((io)) and (rest) 1- ((n)) equal? ((a
@@ -35,10 +35,11 @@
0.0))) sin ((r)) delete-duplicates ((lst)) > ((v . rest)) str-rune ((s n)) with-output-to ((io . body)) abs ((n)) str? ((v)) cons? ((v)) str-split ((str
(sep " \n\t\v\f") (:trim NIL))) aset! ((sequence subscripts… new-value)) - ((n . rest)) makunbound ((sym)) rand (NIL) quasiquote ((expr)) copy-list ((lst
(n NIL))) logand (ints) time-now (NIL) sinh ((r)) top-level-exception-handler ((e)) identity ((v)) untrace ((sym)) count ((pred
-lst)) map-int ((fn count)) table->assoc-list ((ta)) length< ((seq n)) unless ((cond . body)) str->time ((str)) get-syntax ((sym)) ptr? ((v)) expt ((x
-p)) io-read-all ((io)) gc (NIL) table-invert ((ta)) lz-unpack ((data :to destination)
-(data :size decompressed-bytes)) div ((a
-n)) princ (args) last-cdr ((lst)) trace ((sym)) io-filename ((io (new-filename NIL))) gensym? ((v)) defdoc ((term . doc)) cdddr ((lst)) copy-table ((ta)) set-car! ((cell
+lst)) io-pos ((io (new-pos NIL))) map-int ((fn count)) table->assoc-list ((ta)) length< ((seq
+n)) unless ((cond . body)) str->time ((str)) get-syntax ((sym)) ptr? ((v)) expt ((x p)) io-read-all ((io)) gc (NIL) table-invert ((ta)) lz-unpack ((data
+:to destination)
+(data :size decompressed-bytes)) div ((a n)) princ (args) last-cdr ((lst)) trace ((sym)) io-filename ((io
+(new-filename NIL))) gensym? ((v)) defdoc ((term . doc)) cdddr ((lst)) copy-table ((ta)) set-car! ((cell
new-first)) partition ((pred lst)) has? ((table key)) vec (rest) while ((cond . body)) rune (((n
65533))) cadar ((lst)) type-error ((expected-type got-value . msg)) file ((path (mode 420) (:read
NIL)
@@ -48,16 +49,16 @@
(:append NIL))) nth ((lst
n)) cdr ((lst)) / ((n . rest)) newline (((io *io-out*))) separate-doc-from-body ((body (doc
NIL))) rand-u64 (NIL) cdadar ((lst)) sqrt ((x)) reverse ((lst)) lz-pack ((data (level 0))) *prompt* (NIL) member ((item
-lst)) bignum? ((v)) fixnum (((n 0))) f64 (((n 0.0))) memq ((item lst)) str->num ((s (base NIL))) exp ((p)) caaaar ((lst)) traced? ((fn)) s64 (((n
-0))) assoc ((key lst)) + (rest) cadadr ((lst)) compare ((a b)) error (msg) print-exception ((e)) set-top-level-value! ((sym
-expr)) load ((path/io)) getpid (NIL) keyword? ((v)) aref ((sequence subscript0 . rest)) sym? ((v)) defmacro ((form . body)) u64 (((n
-0))) assv ((key lst)) bignum (((n 0))) copy-vec ((vec)) eqv? ((a b)) list (rest) __init_globals (NIL) rand-u32 (NIL) revappend ((lst
+lst)) bignum? ((v)) fixnum (((n 0))) f64 (((n 0.0))) memq ((item lst)) str->num ((s (base NIL))) exp ((p)) caaaar ((lst)) io-column ((io
+(new-column NIL))) traced? ((fn)) s64 (((n 0))) assoc ((key lst)) + (rest) cadadr ((lst)) compare ((a
+b)) error (msg) print-exception ((e)) set-top-level-value! ((sym expr)) load ((path/io)) getpid (NIL) keyword? ((v)) aref ((sequence
+subscript0 . rest)) sym? ((v)) defmacro ((form . body)) u64 (((n 0))) assv ((key lst)) bignum (((n
+0))) copy-vec ((vec)) eqv? ((a b)) list (rest) __init_globals (NIL) rand-u32 (NIL) revappend ((lst
tail)) 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
n)) set-syntax! ((sym fn)) mod0 ((a n)) last-pair ((lst)) path-cwd (((to NIL))) arr? ((v)) cadaar ((lst)) unwind-protect ((expr
-finally)) cos ((r)) every ((pred lst)) atom? ((v)) p64 (((n 0))) str-utf8? ((s)) apply ((f
-arg . rest)) cddr ((lst)) not ((v)) print (args) cdar ((lst)) cdaar ((lst)) iota ((count (start
-0)
-(step 1))) caaddr ((lst)) environment (NIL) getprop ((symbol key (def NIL))) putprop ((symbol
+finally)) cos ((r)) io-skip ((io offset (:end NIL))) every ((pred lst)) atom? ((v)) p64 (((n
+0))) str-utf8? ((s)) apply ((f arg . rest)) cddr ((lst)) not ((v)) print (args) cdar ((lst)) cdaar ((lst)) iota ((count
+(start 0) (step 1))) caaddr ((lst)) environment (NIL) getprop ((symbol key (def NIL))) putprop ((symbol
key val)) * (rest) rand-f32 (NIL) repl (NIL) get ((table key (failed-result))) table? ((v)) u16 (((n
0))) logxor (ints) acos ((x)) time->str ((sec)) caddr ((lst)) to-proper ((lst)) nestlist ((fn
zero n)) table-keys ((ta)) catch ((tag expr)) __start ((argv interactive)) floor ((x)) add-exit-hook ((fn)) str-join ((strlist
@@ -69,7 +70,7 @@
group 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" 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." 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." (doc
group 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
group 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" 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." *os-version* "The \"version\" of the operating system this StreetLISP VM executable\nwas built for.\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 *os-version*\n ; ↳ \"6.14.5-0-edge\" ; Alpine Linux kernel version" 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 integer argument, starting from\n`min` and ending with `max`.\n\nExamples:\n\n (for 0 2 (λ (i) (print (- 2 i))))\n ; ‼ 210" 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 (begin (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 e
\ No newline at end of file
-xception.\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\"" 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 (def l '(1))\n (set-cdr! l l)\n ; ↳ #0=(1 . #0#)\n (length l)\n ; ↳ +inf.0\n (proper-list? l)\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.\n\nExamples:\n\n (random 1)\n ; ↳ 1\n\n (random 1.0)\n ; ↳ 0.69517" 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" *directory-separator* "OS-specific path separator.\n\nIt is preferred over hardcoded `\"/\"`, for portability." 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)" ass
\ No newline at end of file
+xception.\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\"" 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 (def l '(1))\n (set-cdr! l l)\n ; ↳ #0=(1 . #0#)\n (length l)\n ; ↳ +inf.0\n (proper-list? l)\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.\n\nExamples:\n\n (random 1)\n ; ↳ 1\n\n (random 1.0)\n ; ↳ 0.69517" 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" *directory-separator* "OS-specific path separator.\n\nIt is preferred over hardcoded `\"/\"`, for portability." 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)" ass
\ No newline at end of file
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 (def l '(1))\n (set-cdr! l l)\n ; ↳ #0=(1 . #0#)\n (length l)\n ; ↳ +inf.0\n (proper-list? l)\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.\n\nExamples:\n\n (random 1)\n ; ↳ 1\n\n (random 1.0)\n ; ↳ 0.69517" 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" *directory-separator* "OS-specific path separator.\n\nIt is preferred over hardcoded `\"/\"`, for portability." 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)" assq "Return a pair of a matching key and the associated value, or `NIL` if\nnone matched. Keys are compared using `eq?`." most-positive-fixnum "A constant integer closest to positive infinity that can be\nrepresented by fixnum type on this particular platform." 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\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
\ No newline at end of file
group 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 coding style.\n\nExamples:\n\n (def x '(1))\n (if x 'yes 0)\n ; ↳ yes\n (if (str? x) 1 'no)\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\")" 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
group builtin) "Built-in operators." *syntax-environment* "Table containing macro definitions.\n\nThe keys are macro names, the values are their application functions." 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\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 prefix, which\ndefaults to `structname-`. Prefix can be disabled entirely with\n`:conc-name NIL`.\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))))." 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." 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
\ No newline at end of file
@@ -78,11 +79,11 @@
ead 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." 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
group 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
group 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
-le\" \"\" \"\" \"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\")" 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" rand "Return a random non-negative fixnum on its maximum range." 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))" 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 seconds 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 ; ↳ 1746494461.2773349285" 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" 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
\ No newline at end of file
+le\" \"\" \"\" \"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\")" 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" rand "Return a random non-negative fixnum on its maximum range." 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))" 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 seconds 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 ; ↳ 1746494461.2773349285" 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,\noptionally changing it first." 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 valu
\ No newline at end of file
e 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" rand "Return a random non-negative fixnum on its maximum range." 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))" 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 seconds 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 ; ↳ 1746494461.2773349285" 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" 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\nExamples:\n\n (unless (cons? x)\n (princ \"oops!\")\n (newline)\n (type-error 'cons x))" str->time "Return the number of seconds since Epoch from a time and date\nformatted as a string.\n\
\ No newline at end of file
group 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." (doc
group rand) "Random numbers generation." 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
-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
+nExamples:\n\n (princ 1 2 \"abc\")\n ; ‼ 12abc" (doc
(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." rand-u64 "Return a random integer on interval [0, 2⁶⁴-1]." cdadar "Shorthand for (cdr (car (cdr (car lst))))." 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
group debug) "Debugging utilities." caaaar "Shorthand for (car (car (car (car lst))))." 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
group io) "Files and I/O functionality." s64 "Construct a 64-bit signed number." 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))))." 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" 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." 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 new copy of the vector with the elements.\n\nNo copies of the keys nor values are created - original ones are\nreused.\n\nExamples:\n\n (def v #vec(a (1 2 3)))\n (def q (copy-vec v))\n (eq? v q)\n ; ↳ NIL\n (equal? v q)\n ; ↳ T" *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\"`." 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\
\ No newline at end of file
@@ -123,8 +124,9 @@
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
group misc) "Miscellaneous." read-all-of "Call `fn` on an IO object until it runs out of data. Return the list\ncontaining the values returned by `fn` on each call." cddddr "Shorthand for (cdr (cdr (cdr (cdr lst))))." prog1 "Evaluate the expressions in order, return the result of the first one.\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
group 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
-(cdr (cdr (cdr lst))))." prog1 "Evaluate the expressions in order, return the result of the first one.\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
-group 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
+of data. Return the list\ncontaining the values returned by `fn` on each call." cddddr "Shorthand for (cdr (cdr (cdr (cdr lst))))." prog1 "Evaluate the expressions in order, return the result of the first one.\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
+group 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
+group compress) "Compression." 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 "Change the current relative position within the IO object in bytes,\nreturn the absolute position.\n\nTo change the relative position from the end of the file, use the\noptional `:end T` argument and a negative offset." *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." putprop "Associate a property value with the symbol." 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." *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`." rand-f32 "Return a random 32-bit floating pointer number on [0.0, 1.0] interval." 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 sta
\ No newline at end of file
↳ 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
group 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
group compress) "Compression." 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-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." putprop "Associate a property value with the symbol." 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." *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`." rand-f32 "Return a random 32-bit floating pointer number on [0.0, 1.0] interval." 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." 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`ke
\ No newline at end of file
@@ -153,19 +155,18 @@
\")\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." putprop "Associate a property value with the symbol." 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." *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`." rand-f32 "Return a random 32-bit floating pointer number on [0.0, 1.0] interval." 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." 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" acos "Return the arc cosine of `x` in radians." time->str "Return the number of seconds 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)" nestlist "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 (nestlist 1+ 5 3)\n ; ↳ (5 6 7)\n\n (nestlist (λ (x) (* x x)) 2 5)\n ; ↳ (2 4 16 256 65536)\n\n (nestlist (λ (s) (str-sub s 1)) \"hello\" 5)\n ; ↳ (\"hello\" \"ello\" \"llo\" \"lo\" \"o\")" 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 expressio
\ No newline at end of file
group 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)." 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)" 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`.\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
group 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\"" most-negative-fixnum "A constant integer closest to negative infinity that can be\nrepresented by fixnum type on this particular platform." 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\"" cddadr "Shorthand for (cdr (cdr (car (cdr lst))))." 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)" rand-f64 "Return a random 64-bit floating point number on interval [0.0, 1.0]." 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)
-r (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." putprop "Associate a property value with the symbol." 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." *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`." rand-f32 "Return a random 32-bit floating pointer number on [0.0, 1.0] interval." 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." 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" acos "Return the arc cosine of `x` in radians." time->str "Return the number of seconds 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)" nestlist "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 (nestlist 1+ 5 3)\n ; ↳ (5 6 7)\n\n (nestlist (λ (x) (* x x)) 2 5)\n ; ↳ (2 4 16 256 65536)\n\n (nestlist (λ (s) (str-sub s 1)) \"hello\" 5)\n ; ↳ (\"hello\" \"ello\" \"llo\" \"lo\" \"o\")" 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)\
\ No newline at end of file
-group 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)." 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)" 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`.\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
-group 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\"" most-negative-fixnum "A constant integer closest to negative infinity that can be\nrepresented by fixnum type on this particular platform." 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\"" cddadr "Shorthand for (cdr (cdr (car (cdr lst))))." 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)" rand-f64 "Return a random 64-bit floating point number on interval [0.0, 1.0]." 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)
-(:doc-see . nconc) (:doc-see . revappend)) io-eof? ((:doc-group . io)) path-exists? ((:doc-group . io)
-(:doc-see . file) (:doc-see . delete-file)) cadddr ((:doc-group . list)) sort ((:doc-group . list)
-(:doc-see . partition)) fixnum? ((:doc-group . type)
-(:doc-group . number) (:doc-see . fixnum) (:doc-group . builtin)) exit ((:doc-group . sys)) __finish ((:doc-group . vm)
-(:doc-see . __start)) caaar ((:doc-group . list)) s32 ((:doc-group . number) (:doc-see . u32)) u8 ((:doc-group . number)
-(:doc-see . s8)) any ((:doc-group . list) (:doc-see . every)) nthcdr ((:doc-group . list) (:doc-see . nth)) os-getenv ((:doc-group . sys)
-(:doc-see . os-setenv)) s8 ((:doc-group . number) (:doc-see . u8)) io-close ((:doc-group . io)
-(:doc-see . file)) num? ((:doc-group . type)
-(:doc-group . number) (:doc-see . nan?) (:doc-group . builtin)) assert ((:doc-group . debug) (:doc-see . assert-fail)) vec->list ((:doc-group . list)
-(:doc-see . list->vec)) 1+ ((:doc-group . number) (:doc-see . 1-)) throw ((:doc-group . error)
+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." putprop "Associate a property value with the symbol." 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." *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`." rand-f32 "Return a random 32-bit floating pointer number on [0.0, 1.0] interval." 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." 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" acos "Return the arc cosine of `x` in radians." time->str "Return the number of seconds 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)" nestlist "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 (nestlist 1+ 5 3)\n ; ↳ (5 6 7)\n\n (nestlist (λ (x) (* x x)) 2 5)\n ; ↳ (2 4 16 256 65536)\n\n (nestlist (λ (s) (str-sub s 1)) \"hello\" 5)\n ; ↳ (\"hello\" \"ello\" \"llo\" \"lo\" \"o\")" 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." __
\ No newline at end of file
+group 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)." 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)" 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`.\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
+group 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\"" most-negative-fixnum "A constant integer closest to negative infinity that can be\nrepresented by fixnum type on this particular platform." 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\"" cddadr "Shorthand for (cdr (cdr (car (cdr lst))))." 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)" rand-f64 "Return a random 64-bit floating point number on interval [0.0, 1.0]." 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)
+(:doc-see . nconc) (:doc-see . revappend)) io-eof? ((:doc-group . io)) path-exists? ((:doc-group . io)
+(:doc-see . file) (:doc-see . delete-file)) cadddr ((:doc-group . list)) sort ((:doc-group . list)
+(:doc-see . partition)) fixnum? ((:doc-group . type)
+(:doc-group . number) (:doc-see . fixnum) (:doc-group . builtin)) exit ((:doc-group . sys)) __finish ((:doc-group . vm)
+(:doc-see . __start)) caaar ((:doc-group . list)) s32 ((:doc-group . number) (:doc-see . u32)) u8 ((:doc-group . number)
+(:doc-see . s8)) any ((:doc-group . list) (:doc-see . every)) nthcdr ((:doc-group . list) (:doc-see . nth)) os-getenv ((:doc-group . sys)
+(:doc-see . os-setenv)) s8 ((:doc-group . number) (:doc-see . u8)) io-close ((:doc-group . io)
+(:doc-see . file)) num? ((:doc-group . type)
+(:doc-group . number) (:doc-see . nan?) (:doc-group . builtin)) assert ((:doc-group . debug) (:doc-see . assert-fail)) vec->list ((:doc-group . list)
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`." rand-f32 "Return a random 32-bit floating pointer number on [0.0, 1.0] interval." 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." 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" acos "Return the arc cosine of `x` in radians." time->str "Return the number of seconds 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)" nestlist "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 (nestlist 1+ 5 3)\n ; ↳ (5 6 7)\n\n (nestlist (λ (x) (* x x)) 2 5)\n ; ↳ (2 4 16 256 65536)\n\n (nestlist (λ (s) (str-sub s 1)) \"hello\" 5)\n ; ↳ (\"hello\" \"ello\" \"llo\" \"lo\" \"o\")" 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" pi "Mathematical constant π." 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
group 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)." 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)" 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`.\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
group 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\"" most-negative-fixnum "A constant integer closest to negative infinity that can be\nrepresented by fixnum type on this particular platform." 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\"" cddadr "Shorthand for (cdr (cdr (car (cdr lst))))." 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)" rand-f64 "Return a random 64-bit floating point number on interval [0.0, 1.0]." 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)
@@ -177,12 +178,11 @@
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" acos "Return the arc cosine of `x` in radians." time->str "Return the number of seconds 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)" nestlist "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 (nestlist 1+ 5 3)\n ; ↳ (5 6 7)\n\n (nestlist (λ (x) (* x x)) 2 5)\n ; ↳ (2 4 16 256 65536)\n\n (nestlist (λ (s) (str-sub s 1)) \"hello\" 5)\n ; ↳ (\"hello\" \"ello\" \"llo\" \"lo\" \"o\")" 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" pi "Mathematical constant π." 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
group 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)." 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)" 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`.\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
group 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\"" most-negative-fixnum "A constant integer closest to negative infinity that can be\nrepresented by fixnum type on this particular platform." 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\"" cddadr "Shorthand for (cdr (cdr (car (cdr lst))))." 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)" rand-f64 "Return a random 64-bit floating point number on interval [0.0, 1.0]." 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)
-les:\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)" nestlist "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 (nestlist 1+ 5 3)\n ; ↳ (5 6 7)\n\n (nestlist (λ (x) (* x x)) 2 5)\n ; ↳ (2 4 16 256 65536)\n\n (nestlist (λ (s) (str-sub s 1)) \"hello\" 5)\n ; ↳ (\"hello\" \"ello\" \"llo\" \"lo\" \"o\")" 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" pi "Mathematical constant π." 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
-group 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)." 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)" 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`.\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
-group 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\"" most-negative-fixnum "A constant integer closest to negative infinity that can be\nrepresented by fixnum type on this particular platform." 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\"" cddadr "Shorthand for (cdr (cdr (car (cdr lst))))." 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)" rand-f64 "Return a random 64-bit floating point number on interval [0.0, 1.0]." 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)
-(:doc-see . nconc) (:doc-see . revappend)) io-eof? ((:doc-group . io)) path-exists? ((:doc-group . io)
-(:doc-see . file) (:doc-see . delete-file)) cadddr ((:doc-group . list)) sort ((:doc-group . list)
-(:doc-see . partition)) fixnum? ((:doc-group . type)
+ogxor 2 3)\n ; ↳ 1\n\n (logxor 2 3 4)\n ; ↳ 5" acos "Return the arc cosine of `x` in radians." time->str "Return the number of seconds 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)" nestlist "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 (nestlist 1+ 5 3)\n ; ↳ (5 6 7)\n\n (nestlist (λ (x) (* x x)) 2 5)\n ; ↳ (2 4 16 256 65536)\n\n (nestlist (λ (s) (str-sub s 1)) \"hello\" 5)\n ; ↳ (\"hello\" \"ello\" \"llo\" \"lo\" \"o\")" 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" pi "Mathematical constant π." 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
+group 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)." 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)" 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`.\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
+group 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\"" most-negative-fixnum "A constant integer closest to negative infinity that can be\nrepresented by fixnum type on this particular platform." 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\"" cddadr "Shorthand for (cdr (cdr (car (cdr lst))))." 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)" rand-f64 "Return a random 64-bit floating point number on interval [0.0, 1.0]." 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)
+(:doc-see . nconc) (:doc-see . revappend)) io-eof? ((:doc-group . io)) path-exists? ((:doc-group . io)
+(:doc-see . file) (:doc-see . delete-file)) cadddr ((:doc-group . list)) sort ((:doc-group . list)
(λ (s) (str-sub s 1)) \"hello\" 5)\n ; ↳ (\"hello\" \"ello\" \"llo\" \"lo\" \"o\")" 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" pi "Mathematical constant π." 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
group 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)." 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)" 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`.\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
group 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\"" most-negative-fixnum "A constant integer closest to negative infinity that can be\nrepresented by fixnum type on this particular platform." 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\"" cddadr "Shorthand for (cdr (cdr (car (cdr lst))))." 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)" rand-f64 "Return a random 64-bit floating point number on interval [0.0, 1.0]." 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)
@@ -201,11 +201,10 @@
r-join '(\"\" \"n\" \"9\" \"heh\")\n *directory-separator*)\n ; ↳ \"/n/9/heh\"\n\n (str-join '(\"a\" \"b\" \"c\") #\\.)\n ; ↳ \"a.b.c\"" (doc
group 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)." 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)" 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`.\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
group 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\"" most-negative-fixnum "A constant integer closest to negative infinity that can be\nrepresented by fixnum type on this particular platform." 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\"" cddadr "Shorthand for (cdr (cdr (car (cdr lst))))." 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)" rand-f64 "Return a random 64-bit floating point number on interval [0.0, 1.0]." 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)
-t 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)" 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`.\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
-group 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\"" most-negative-fixnum "A constant integer closest to negative infinity that can be\nrepresented by fixnum type on this particular platform." 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\"" cddadr "Shorthand for (cdr (cdr (car (cdr lst))))." 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)" rand-f64 "Return a random 64-bit floating point number on interval [0.0, 1.0]." 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)
-(:doc-see . nconc) (:doc-see . revappend)) io-eof? ((:doc-group . io)) path-exists? ((:doc-group . io)
-(:doc-see . file) (:doc-see . delete-file)) cadddr ((:doc-group . list)) sort ((:doc-group . list)
-(:doc-see . partition)) fixnum? ((:doc-group . type)
+(doc
+group 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)." 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)" 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`.\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
+group 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\"" most-negative-fixnum "A constant integer closest to negative infinity that can be\nrepresented by fixnum type on this particular platform." 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\"" cddadr "Shorthand for (cdr (cdr (car (cdr lst))))." 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)" rand-f64 "Return a random 64-bit floating point number on interval [0.0, 1.0]." 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)
+(:doc-see . nconc) (:doc-see . revappend)) io-eof? ((:doc-group . io)) path-exists? ((:doc-group . io)
e.\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)" 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`.\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
group 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\"" most-negative-fixnum "A constant integer closest to negative infinity that can be\nrepresented by fixnum type on this particular platform." 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\"" cddadr "Shorthand for (cdr (cdr (car (cdr lst))))." 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)" rand-f64 "Return a random 64-bit floating point number on interval [0.0, 1.0]." 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)
(:doc-see . nconc) (:doc-see . revappend)) io-eof? ((:doc-group . io)) path-exists? ((:doc-group . io)
@@ -465,7 +464,7 @@
87e22489e22488e2e4:232487e22489e2e3:" #(separate-doc-from-body
append (NIL) sym-set-doc quote) 13) assert #fn("n1200D2122230e2e2e2e4:" #(if raise quote
assert-failed) 11) case #fn("z1IIb6b78620_4872186>1_4225023880e2e12425e126278788>215252e3:" #(#fn("n1700513400:210e2:" #(self-evaluating?
-fn("n1700513400:210e2:" #(self-evaluating?
+#fn("n1200r4e3:" #(aref) 7) defdoc #fn("z10B86;35040<;J404086;35040=70711225251<863I0232487e22489e22488e2e4:232487e22489e2e3:" #(separate-doc-from-body
R3=0210A<151e3:1H3=0220A<151e3:1=J>0220A<1<51e3:73741523=0250261e2e3:270261e2e3:" #(else
eq? eqv? every sym? memq quote memv) vals->cond 8)
#fn(gensym) let #fn(nconc) cond #fn(map) #fn("n1A<F0<520=P:" 7)) 14) quote #fn("n1200e2:" #($quote) 6) set! #fn("z22001e382J5087:2187Ib:8:228:>1_48:<^18251PP:" #($set!
--- a/src/compiler.sl
+++ b/src/compiler.sl
@@ -141,7 +141,7 @@
(for-each
(λ (addr labl)
- (io-seek bcode addr)
+ (io-pos bcode addr)
(io-write bcode ((if long? s32 s16)
(- (get label-to-loc labl) addr))))
fixup-to-label)
--- a/src/docs.sl
+++ b/src/docs.sl
@@ -1296,3 +1296,38 @@
; ‼ I/O error: closed file»
:doc-group io
:doc-see file)
+
+(defdoc (io-line io (new-line NIL))
+ «Return the current absolute position within the IO object in number of
+ lines, optionally changing it first.
+
+ Line number is only applicable to files opened for reading. If
+ position is changed with `io-skip` or `io-pos`, the behavior is
+ undefined.»
+ :doc-group io
+ :doc-see io-column)
+
+(defdoc (io-column io (new-column NIL))
+ «Return the current absolute position within the IO object in number of
+ columns, optionally changing it first.
+
+ Column number is only applicable to files opened for reading. If
+ position is changed with `io-skip` or `io-pos`, the behavior is
+ undefined.»
+ :doc-group io
+ :doc-see io-line)
+
+(defdoc (io-pos io (new-pos NIL))
+ «Return the current absolute position within the IO object in bytes,
+ optionally changing it first.»
+ :doc-group io
+ :doc-see io-skip)
+
+(defdoc (io-skip io offset (:end NIL))
+ «Change the current relative position within the IO object in bytes,
+ return the absolute position.
+
+ To change the relative position from the end of the file, use the
+ optional `:end T` argument and a negative offset.»
+ :doc-group io
+ :doc-see io-pos)
--- a/src/io.c
+++ b/src/io.c
@@ -5,8 +5,9 @@
#include "read.h"
#include "io.h"
-static sl_v sl_linesym, sl_blocksym, sl_memorysym;
-static sl_v sl_ioinsym, sl_whitespace;
+static sl_v iosym, rdsym, wrsym, apsym, crsym, truncsym;
+static sl_v linesym, blocksym, memorysym;
+static sl_v ioinsym, wssym, endsym;
sl_v sl_iooutsym;
sl_type *sl_iotype;
@@ -89,15 +90,15 @@
for(int i = 1; i < nargs; i++){
if(isfixnum(args[i]))
mode = tosize(args[i]);
- if(args[i] == sl_rdsym)
+ if(args[i] == rdsym)
r = true;
- else if(args[i] == sl_wrsym)
+ else if(args[i] == wrsym)
w = true;
- else if(args[i] == sl_apsym)
+ else if(args[i] == apsym)
a = w = true;
- else if(args[i] == sl_crsym)
+ else if(args[i] == crsym)
c = w = true;
- else if(args[i] == sl_truncsym)
+ else if(args[i] == truncsym)
t = w = true;
}
if(!r && !w && !c && !t && !a)
@@ -119,11 +120,11 @@
int bm;
if(m == sl_nil)
bm = bm_none;
- else if(m == sl_linesym)
+ else if(m == linesym)
bm = bm_line;
- else if(m == sl_blocksym)
+ else if(m == blocksym)
bm = bm_block;
- else if(m == sl_memorysym)
+ else if(m == memorysym)
bm = bm_memory;
else
bthrow(lerrorf(sl_errarg, "invalid buffer mode"));
@@ -134,9 +135,9 @@
argcount(nargs, 1);
switch(toio(args[0])->bm){
case bm_none: return sl_nil;
- case bm_line: return sl_linesym;
- case bm_block: return sl_blocksym;
- case bm_memory: return sl_memorysym;
+ case bm_line: return linesym;
+ case bm_block: return blocksym;
+ case bm_memory: return memorysym;
default: abort();
}
}
@@ -156,7 +157,7 @@
bool ws = false;
if(nargs >= 2 && nargs <= 3){
int i;
- if(args[i = 0] == sl_whitespace || (nargs > 2 && args[i = 1] == sl_whitespace)){
+ if(args[i = 0] == wssym || (nargs > 2 && args[i = 1] == wssym)){
ws = args[++i] != sl_nil;
if(i < 2) // (read :whitespace T io)
args[0] = args[2];
@@ -163,7 +164,7 @@
nargs -= 2;
}
}
- sl_v a = nargs == 0 ? sym_value(sl_ioinsym) : args[0];
+ sl_v a = nargs == 0 ? sym_value(ioinsym) : args[0];
if(nargs > 1)
argcount(nargs, 1);
ios *s = toio(a);
@@ -228,15 +229,23 @@
BUILTIN("io-skip", io_skip)
{
- argcount(nargs, 2);
+ if(nargs < 2 || nargs == 3 || nargs > 4)
+ argcount(nargs, 2);
+ bool end = false;
+ if(nargs == 4){
+ if(args[2] == endsym)
+ end = args[3] != sl_nil;
+ else
+ bthrow(lerrorf(sl_errarg, "invalid arguments"));
+ }
ios *s = toio(args[0]);
if(s->state == bst_closed)
bthrow(lerrorf(sl_errio, "closed file"));
soffset off = tooffset(args[1]);
- soffset res = ios_skip(s, off);
+ soffset res = ios_skip(s, off, end);
if(res < 0)
return sl_nil;
- return sizeof(res) == sizeof(s64int) ? mk_s64(res) : mk_s32(res);
+ return size_wrap((usize)res);
}
BUILTIN("io-flush", io_flush)
@@ -279,27 +288,15 @@
return ios_eof(toio(args[0])) ? sl_t : sl_nil;
}
-BUILTIN("io-seek", io_seek)
-{
- argcount(nargs, 2);
- ios *s = toio(args[0]);
- if(s->state == bst_closed)
- bthrow(lerrorf(sl_errio, "closed file"));
- usize pos = tosize(args[1]);
- soffset res = ios_seek(s, (soffset)pos);
- return res < 0 ? sl_nil : sl_t;
-}
-
BUILTIN("io-pos", io_pos)
{
- argcount(nargs, 1);
+ if(nargs < 1 || nargs > 2)
+ argcount(nargs, 1);
ios *s = toio(args[0]);
if(s->state == bst_closed)
bthrow(lerrorf(sl_errio, "closed file"));
- soffset res = ios_pos(s);
- if(res < 0)
- return sl_nil;
- return size_wrap((usize)res);
+ soffset res = nargs == 2 ? ios_seek(s, tosize(args[1])) : ios_skip(s, 0, false);
+ return res < 0 ? sl_nil : size_wrap((usize)res);
}
BUILTIN("write", write)
@@ -567,19 +564,20 @@
void
io_init(void)
{
- sl_iosym = mk_csym("io");
- sl_rdsym = mk_csym(":read");
- sl_wrsym = mk_csym(":write");
- sl_apsym = mk_csym(":append");
- sl_crsym = mk_csym(":create");
- sl_truncsym = mk_csym(":truncate");
- sl_linesym = mk_csym(":line");
- sl_blocksym = mk_csym(":block");
- sl_memorysym = mk_csym(":memory");
- sl_whitespace = mk_csym(":whitespace");
- sl_ioinsym = mk_csym("*io-in*");
+ iosym = mk_csym("io");
+ rdsym = mk_csym(":read");
+ wrsym = mk_csym(":write");
+ apsym = mk_csym(":append");
+ crsym = mk_csym(":create");
+ truncsym = mk_csym(":truncate");
+ linesym = mk_csym(":line");
+ blocksym = mk_csym(":block");
+ memorysym = mk_csym(":memory");
+ wssym = mk_csym(":whitespace");
+ endsym = mk_csym(":end");
+ ioinsym = mk_csym("*io-in*");
sl_iooutsym = mk_csym("*io-out*");
- sl_iotype = define_opaque_type(sl_iosym, sizeof(ios), &io_vtable, nil);
+ sl_iotype = define_opaque_type(iosym, sizeof(ios), &io_vtable, nil);
set(mk_csym("*stdout*"), cvalue_from_ref(sl_iotype, ios_stdout, sizeof(ios)));
set(mk_csym("*stderr*"), cvalue_from_ref(sl_iotype, ios_stderr, sizeof(ios)));
set(mk_csym("*stdin*"), cvalue_from_ref(sl_iotype, ios_stdin, sizeof(ios)));
--- a/src/ios.c
+++ b/src/ios.c
@@ -372,21 +372,22 @@
soffset
ios_seek(ios *s, soffset pos)
{
- if(s->state == bst_closed)
+ if(s->state == bst_closed || pos < 0)
return -1;
s->_eof = false;
if(s->bm == bm_memory){
- if((usize)pos > s->size)
- return -1;
+ if((usize)pos >= s->size)
+ pos = s->size;
s->bpos = pos;
}else{
ios_flush(s);
- soffset fdpos = lseek(s->fd, pos, SEEK_SET);
- if(fdpos == (soffset)-1)
- return fdpos;
s->bpos = s->size = 0;
+ soffset fdpos = lseek(s->fd, pos, SEEK_SET);
+ if(fdpos < 0)
+ return -1;
+ pos = fdpos;
}
- return 0;
+ return pos;
}
soffset
@@ -408,63 +409,30 @@
}
soffset
-ios_skip(ios *s, soffset offs)
+ios_skip(ios *s, soffset offs, bool end)
{
if(s->state == bst_closed)
return -1;
- if(offs != 0){
+ if(end && ios_seek_end(s) < 0)
+ return -1;
+ s->_eof = false;
+ if(s->bm == bm_memory){
if(offs > 0){
- if(offs <= (soffset)(s->size-s->bpos)){
+ if(offs <= (soffset)(s->size-s->bpos))
s->bpos += offs;
- return 0;
- }else if(s->bm == bm_memory){
- // TODO: maybe grow buffer
- return -1;
- }
+ else
+ s->bpos = s->size;
}else if(offs < 0){
- if(-offs <= (soffset)s->bpos){
+ if((soffset)s->bpos+offs >= 0)
s->bpos += offs;
- s->_eof = false;
- return 0;
- }else if(s->bm == bm_memory){
- return -1;
- }
+ else
+ s->bpos = 0;
}
- ios_flush(s);
- if(s->state == bst_wr)
- offs += s->bpos;
- else if(s->state == bst_rd)
- offs -= s->size - s->bpos;
- soffset fdpos = lseek(s->fd, offs, SEEK_CUR);
- if(fdpos == (soffset)-1)
- return fdpos;
- s->bpos = s->size = 0;
- s->_eof = false;
+ return s->bpos;
}
- return 0;
-}
-
-soffset
-ios_pos(ios *s)
-{
- if(s->state == bst_closed)
- return -1;
- if(s->bm == bm_memory)
- return (soffset)s->bpos;
-
- soffset fdpos = s->fpos;
- if(fdpos == (soffset)-1){
- fdpos = lseek(s->fd, 0, SEEK_CUR);
- if(fdpos == (soffset)-1)
- return fdpos;
- s->fpos = fdpos;
- }
-
- if(s->state == bst_wr)
- fdpos += s->bpos;
- else if(s->state == bst_rd)
- fdpos -= s->size - s->bpos;
- return fdpos;
+ ios_flush(s);
+ s->bpos = s->size = 0;
+ return lseek(s->fd, offs, SEEK_CUR);
}
int
--- a/src/ios.h
+++ b/src/ios.h
@@ -62,8 +62,7 @@
usize ios_write(ios *s, const void *data, usize n) sl_nonnull(1, 2);
soffset ios_seek(ios *s, soffset pos) sl_nonnull(1); // absolute seek
soffset ios_seek_end(ios *s) sl_nonnull(1);
-soffset ios_skip(ios *s, soffset offs) sl_nonnull(1); // relative seek
-soffset ios_pos(ios *s) sl_nonnull(1); // get current position
+soffset ios_skip(ios *s, soffset offs, bool end) sl_nonnull(1); // relative seek
int ios_trunc(ios *s, soffset size) sl_nonnull(1);
bool ios_eof(ios *s) sl_purefn sl_nonnull(1);
int ios_flush(ios *s) sl_nonnull(1);
--- a/src/plan9/lsd.sl
+++ b/src/plan9/lsd.sl
@@ -112,11 +112,11 @@
(lsd-follow addr))
(defmacro (io-pread f off . rest)
- `(begin (io-seek ,f ,off)
+ `(begin (io-pos ,f ,off)
(io-read ,f ,.rest)))
(defmacro (io-pwrite f off . rest)
- `(begin (io-seek ,f ,off)
+ `(begin (io-pos ,f ,off)
(io-write ,f ,.rest)
(io-flush ,f)))
@@ -196,7 +196,7 @@
:doc-group lsd
(def (readstr loc)
(unless coref (error "not attached to proc"))
- (io-seek coref loc)
+ (io-pos coref loc)
(str-trim (io-read-until coref 0) NIL (λ (r) (eq? r #\nul))))
(if n
(map 'vec readstr (c-ptr (@ loc) n))
--- a/src/sl.c
+++ b/src/sl.c
@@ -25,7 +25,6 @@
static sl_v sl_errarity;
sl_v sl_tablesym, sl_arrsym;
-sl_v sl_iosym, sl_rdsym, sl_wrsym, sl_apsym, sl_crsym, sl_truncsym;
sl_v sl_s8sym, sl_u8sym, sl_s16sym, sl_u16sym, sl_s32sym, sl_u32sym;
sl_v sl_s64sym, sl_u64sym, sl_p32sym, sl_p64sym, sl_ptrsym, sl_bignumsym;
sl_v sl_utf8sym, sl_runesym, sl_f32sym, sl_f64sym;
--- a/src/sl.h
+++ b/src/sl.h
@@ -497,7 +497,6 @@
extern sl_v sl_emptyvec, sl_emptystr;
extern sl_v sl_tablesym, sl_arrsym;
-extern sl_v sl_iosym, sl_rdsym, sl_wrsym, sl_apsym, sl_crsym, sl_truncsym;
extern sl_v sl_s8sym, sl_u8sym, sl_s16sym, sl_u16sym, sl_s32sym, sl_u32sym;
extern sl_v sl_s64sym, sl_u64sym, sl_p32sym, sl_p64sym, sl_ptrsym, sl_bignumsym;
extern sl_v sl_utf8sym, sl_runesym, sl_f32sym, sl_f64sym, sl_vecstructsym, sl_structsym;
--- a/test/defstruct.sl
+++ b/test/defstruct.sl
@@ -78,7 +78,7 @@
(assert (= (scc-c ccx) 3))
(let ((b (buffer))) ; able to read the #S(...) form with a renamed constructor
(write ccx b)
- (io-seek b 0)
+ (io-pos b 0)
(assert (equal? (read b) ccx)))
; custom constructor - no keywords
@@ -92,7 +92,7 @@
(assert (= (scc2-c cc2x) 4))
(let ((b (buffer))) ; able to read the #S(...) form with a custom constructor
(write cc2x b)
- (io-seek b 0)
+ (io-pos b 0)
(assert (equal? (read b) cc2x)))
; no predicate
--- a/tools/gen.sl
+++ b/tools/gen.sl
@@ -624,7 +624,7 @@
(io-close builtins)
;; at last, copy the buffers to the actual files in git repo.
- (io-seek c-header 0)
+ (io-pos c-header 0)
(io-copy (new "opcodes.h") c-header)
- (io-seek c-code 0)
+ (io-pos c-code 0)
(io-copy (new "opcodes.c") c-code))
--
⑨