History

io-write docs: fix the fix

Sigrid Solveig Haflínudóttir committed 1 year ago

Commit 165dffb1 parent 280f5cc2 files · +2 −2Browse files

Showing the changes to boot (1 of 2 files). Show all

Unified · Split

boot/sl.boot+1−1
@@ -76,7 +76,7 @@ group prop) "Dealing with properties of symbols." (doc group vm) "VM-related fu · 75 unmodified lines
76group 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`." (doc76group 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
77group time) "Measuring, manipulating and displaying time." copy-tree "Return a recursive copy of the list.\n\nUnlike `copy-list`, this function copies subelements of the list\nrecursively.\n\nExamples:\n\n (def a '(1 (2 3)))\n (def b (copy-tree a))\n (equal? a b)\n ; ↳ T\n (eq? a b)\n ; ↳ NIL\n (equal? (cadr a) (cadr b))\n ; ↳ T\n (eq? (cadr a) (cadr b))\n ; ↳ NIL" f32 "Construct a 32-bit floating point number." sin "Return the sine of `r`, where `r` is given in radians." delete-duplicates "Return a copy of the list with duplicated elements removed.\n\nElements are tested for duplicates using `equal?`. The order of the\nelements is preserved in the resulting list.\n\nExamples:\n\n (delete-duplicates '(a 0 b c1 a b 3 c 5))\n ; ↳ (a 0 b c1 3 c 5)" > "Return `T` if the arguments are in strictly decreasing order (previous\none is greater than the next one)." str-rune "Return the nth rune of the string.\n\nThrows an exception if the index `n` is out of bounds.\n\nExamples:\n\n (str-rune \"йцукен\" 3)\n ; ↳ #\\к" with-output-to "Evaluate expressions in `body` with `*io-out*` set to `io` during the\nevaluation.\n\nExamples:\n\n ; write a string \"hello, world!\" to a file\n ; end with a newline\n (with-output-to (file \"/tmp/1.txt\" :create :truncate :write)\n (print \"hello, world!\")\n (newline))" abs "Return absolute value of the argument." *linefeed* "OS-specific _line_ _feed_ value.\n\nIt is preferred over hardcoded `\"\\n\"`, for portability." str? "Return `T` if the argument is a string, `NIL` otherwise." cons? "Return `T` if `v` is a cons cell, `NIL` otherwise.\n\nExamples:\n\n (cons? 0)\n ; ↳ NIL\n\n (cons? NIL)\n ; ↳ NIL\n\n (cons? '(1))\n ; ↳ T" str-split "Return a list of substrings of `str` by splitting at any character in\nthe string `sep`. The splitting characters are removed.\n\nBy default the string is split on space, line feed (newline),\nhorizontal and vertical tab, and form feed.\n\nTrim removes empty strings from the list.\n\nExamples:\n\n (str-split \"hello world\")\n ; ↳ (\"hello\" \"world\")\n\n (str-split \"multiple spaces \")\n ; ↳ (\"multiple\" \"\" \"\" \"spaces\" \"\")\n\n (str-split \"multiple spaces \" :trim T)\n ; ↳ (\"multiple\" \"spaces\")\n\n (str-split \"too many vowels\" \"aeiou\")\n ; ↳ (\"t\" \"\" \" m\" \"ny v\" \"w\" \"ls\")" 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.\n\nExamples:\n\n (def f (buffer))\n (io-write f \"hello, world!\")\n (io-pos f 64)\n ; ↳ 13\n (io-pos f 7)\n ; ↳ 7\n (read f)\n ; ↳ world!" 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\nBecause the supported format is limited, the returned value will have\n(at most) precision in full seconds.\n\nExamples:\n\n (str->time \"Tue May 6 03:21:01 CES 2025\")\n ; ↳ 1746494461" get-syntax "Return a macro application function based on its name, or `NIL` if\nit's not defined." (doc77group time) "Measuring, manipulating and displaying time." copy-tree "Return a recursive copy of the list.\n\nUnlike `copy-list`, this function copies subelements of the list\nrecursively.\n\nExamples:\n\n (def a '(1 (2 3)))\n (def b (copy-tree a))\n (equal? a b)\n ; ↳ T\n (eq? a b)\n ; ↳ NIL\n (equal? (cadr a) (cadr b))\n ; ↳ T\n (eq? (cadr a) (cadr b))\n ; ↳ NIL" f32 "Construct a 32-bit floating point number." sin "Return the sine of `r`, where `r` is given in radians." delete-duplicates "Return a copy of the list with duplicated elements removed.\n\nElements are tested for duplicates using `equal?`. The order of the\nelements is preserved in the resulting list.\n\nExamples:\n\n (delete-duplicates '(a 0 b c1 a b 3 c 5))\n ; ↳ (a 0 b c1 3 c 5)" > "Return `T` if the arguments are in strictly decreasing order (previous\none is greater than the next one)." str-rune "Return the nth rune of the string.\n\nThrows an exception if the index `n` is out of bounds.\n\nExamples:\n\n (str-rune \"йцукен\" 3)\n ; ↳ #\\к" with-output-to "Evaluate expressions in `body` with `*io-out*` set to `io` during the\nevaluation.\n\nExamples:\n\n ; write a string \"hello, world!\" to a file\n ; end with a newline\n (with-output-to (file \"/tmp/1.txt\" :create :truncate :write)\n (print \"hello, world!\")\n (newline))" abs "Return absolute value of the argument." *linefeed* "OS-specific _line_ _feed_ value.\n\nIt is preferred over hardcoded `\"\\n\"`, for portability." str? "Return `T` if the argument is a string, `NIL` otherwise." cons? "Return `T` if `v` is a cons cell, `NIL` otherwise.\n\nExamples:\n\n (cons? 0)\n ; ↳ NIL\n\n (cons? NIL)\n ; ↳ NIL\n\n (cons? '(1))\n ; ↳ T" str-split "Return a list of substrings of `str` by splitting at any character in\nthe string `sep`. The splitting characters are removed.\n\nBy default the string is split on space, line feed (newline),\nhorizontal and vertical tab, and form feed.\n\nTrim removes empty strings from the list.\n\nExamples:\n\n (str-split \"hello world\")\n ; ↳ (\"hello\" \"world\")\n\n (str-split \"multiple spaces \")\n ; ↳ (\"multiple\" \"\" \"\" \"spaces\" \"\")\n\n (str-split \"multiple spaces \" :trim T)\n ; ↳ (\"multiple\" \"spaces\")\n\n (str-split \"too many vowels\" \"aeiou\")\n ; ↳ (\"t\" \"\" \" m\" \"ny v\" \"w\" \"ls\")" 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.\n\nExamples:\n\n (def f (buffer))\n (io-write f \"hello, world!\")\n (io-pos f 64)\n ; ↳ 13\n (io-pos f 7)\n ; ↳ 7\n (read f)\n ; ↳ world!" 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\nBecause the supported format is limited, the returned value will have\n(at most) precision in full seconds.\n\nExamples:\n\n (str->time \"Tue May 6 03:21:01 CES 2025\")\n ; ↳ 1746494461" get-syntax "Return a macro application function based on its name, or `NIL` if\nit's not defined." (doc
78group 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." (doc78group 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
79group rand) "Random numbers generation." io-write "Write the value to the IO object, return the number of bytes written.\n\nThe value may be a string, a fixed width number, a rune or an array.\n\nWhen writing a rune or an array of runes, they will be converted and\nwritten as an UTF-8 string.\n\nExamples:\n\n (io-write *stdout* \"hello\" 1)\n ; ‼ ello\n ; ↳ 4\n\n (io-write *stdout* \"hello\" 1 3)\n ; ‼ ell\n ; ↳ 3\n\n (io-write *stdout* \"hello\" 5)\n ; ↳ 0\n\n (io-write *stdout* \"hello\" 6)\n ; ‼ index 6 out of bounds for \"hello\"\n\n (io-write *stdout* (u32 #x44434241))\n ; ‼ ABCD\n ; ↳ 4\n\n (io-write *stdout* (u32 #x44434241) 1)\n ; ‼ BCD\n ; ↳ 3" 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" (doc79group rand) "Random numbers generation." io-write "Write the value to the IO object, return the number of bytes written.\n\nThe value may be a string, a fixed width number, a rune or an array.\n\nWhen writing a rune or an array of runes, they will be converted and\nwritten as an UTF-8 string.\n\nExamples:\n\n (io-write *stdout* \"hello\")\n ; ‼ hello\n ; ↳ 5\n\n (io-write *stdout* (u32 #x44434241))\n ; ‼ ABCD\n ; ↳ 4\n\n (io-write *stdout* #\\λ)\n ; ‼ λ\n ; ↳ 2\n\n (io-write *stdout* (arr 'rune #\\λ #\\= #\\l #\\a #\\m #\\b #\\d #\\a))\n ; ‼ λ=lambda\n ; ↳ 9" table-invert "Return a new table with the keys and values from the original table\nbut entries _inverted_ - values to keys and keys to values.\n\nNote that if the original table had several keys mapped to the same\nvalue, only one such mapping will be stored in the new table.\n\nExamples:\n\n (def t #table(a 1 b 2 c 1))\n (table-invert t)\n ; ↳ #table(1 a 2 b)" lz-unpack "Return decompressed data previously compressed using lz-pack.\n\nEither destination for the decompressed data or the expected size of\nthe decompressed data must be specified. In the latter case a new\narray is allocated." div "Return the quotient of the Euclidean division `a/n`.\n\nExamples:\n\n (div 10 3)\n ; ↳ 3\n\n (div -10 3)\n ; ↳ -4\n\n (div -10 -3)\n ; ↳ 4\n\n (div 10 -3)\n ; ↳ -3" princ "Print the arguments to *io-out* with `*print-readably*` set to `NIL`.\n\nExamples:\n\n (princ 1 2 \"abc\")\n ; ‼ 12abc" (doc
80group struct) "Declaring and manipulating structures." last-cdr "Return the second element of the last cell in the list.\n\nIt will always evaluate to `NIL` with any proper list.\n\nExamples:\n\n (last-cdr '(1 2 3))\n ; ↳ NIL\n\n (last-cdr '(1 2 . 3))\n ; ↳ 3" trace "Enable tracing for the function bound to the symbol.\n\nWhen tracing is enabled for the function, before evaluating the call\nthe name and arguments will be printed to `*io-out*`.\n\nExamples:\n\n (trace 'map)\n (map odd? (list (+ 1 2) (+ 3 4)))\n ; ‼ (map #fn(\"n170051S:\" #(even?) odd? 6) (3 7))\n ; ↳ (T T)" io-filename "Return the filename of the IO object or change it.\n\nChanging the filename does not cause any side effects. The filename\nis purely informative and does not necessarily reflect the actual\npath.\n\nExamples:\n\n (def f (buffer))\n (io-filename b)\n ; ↳ \"\"\n (io-filename b \"new name\") ; change the filename\n ; ↳ \"new name\"\n (io-filename b)\n ; ↳ \"new name\"\n\n (def f (file \"/dev/random\"))\n (io-filename f)\n ; ↳ \"/dev/random\"\n (io-close f)\n (io-filename f) ; preserved even after it's closed\n ; ↳ \"/dev/random\"\n\n (io-filename *io-out*)\n ; ↳ \"*stdout*\"" gensym? "Return `T` if the argument is a gensym, `NIL` otherwise." (doc80group struct) "Declaring and manipulating structures." last-cdr "Return the second element of the last cell in the list.\n\nIt will always evaluate to `NIL` with any proper list.\n\nExamples:\n\n (last-cdr '(1 2 3))\n ; ↳ NIL\n\n (last-cdr '(1 2 . 3))\n ; ↳ 3" trace "Enable tracing for the function bound to the symbol.\n\nWhen tracing is enabled for the function, before evaluating the call\nthe name and arguments will be printed to `*io-out*`.\n\nExamples:\n\n (trace 'map)\n (map odd? (list (+ 1 2) (+ 3 4)))\n ; ‼ (map #fn(\"n170051S:\" #(even?) odd? 6) (3 7))\n ; ↳ (T T)" io-filename "Return the filename of the IO object or change it.\n\nChanging the filename does not cause any side effects. The filename\nis purely informative and does not necessarily reflect the actual\npath.\n\nExamples:\n\n (def f (buffer))\n (io-filename b)\n ; ↳ \"\"\n (io-filename b \"new name\") ; change the filename\n ; ↳ \"new name\"\n (io-filename b)\n ; ↳ \"new name\"\n\n (def f (file \"/dev/random\"))\n (io-filename f)\n ; ↳ \"/dev/random\"\n (io-close f)\n (io-filename f) ; preserved even after it's closed\n ; ↳ \"/dev/random\"\n\n (io-filename *io-out*)\n ; ↳ \"*stdout*\"" gensym? "Return `T` if the argument is a gensym, `NIL` otherwise." (doc
81group syntax) "StreetLISP syntax and macros." defdoc "Define documentation for a top level term.\n\nIf `term` is a function signature and `doc` is not specified, just\nthe signature will be included in the documentation, without\nreplacing any previously defined.\n\nFirst `doc` argument is supposed to be a string with the description\nof the term. The following arguments are expected to be optional tag\npairings that provide grouping for multiple symbols and \"see also\"\nreferences.\n\nUseful in cases where setting the documentation for a term can't\n(or not preferred to) be done during the definition of said term.\nOne of those reasons could be that the term is a built-in function\nimplemented in C.\n\nExamples:\n\n (defdoc (func arg (arg2 0))\n \"Return something about the `arg` and `arg2`. This is a short\n description.\n\n This is the longer description, following the short one.\n\n Examples:\n\n (func 0)\n ; ↳ T\n\n (func 1 3)\n ; ↳ NIL\"\n :doc-group stuff\n :doc-see func2)\n (defdoc (func arg (:another-variant NIL)))" cdddr "Shorthand for (cdr (cdr (cdr lst)))." copy-table "Return a new copy of the table with the keys and values preserved.\n\nNo copies of the keys nor values are created - original ones are\nreused.\n\nExamples:\n\n (def t #table(a (1 2 3)))\n (def q (copy-table t))\n (eq? t q)\n ; ↳ NIL\n (eq? (get t 'a) (get q 'a))\n ; ↳ T" set-car! "Modify a cons cell (a list) in-place by putting `new-first` as its\nfirst element (head of the list). Return the modified cons\ncell (list).\n\nExamples:\n\n (def q '(1 2 3 4 5))\n (set-car! q 0)\n ; ↳ (0 6 7)\n q\n ; ↳ (0 6 7)" partition "Return two lists where the first contains the elements of the original\nlist which satisfy the predicate and the second containing the rest of\nthe elements.\n\nBoth lists will have the elements appear in the same order as in the\noriginal list.\n\nExamples:\n\n ; split the list into numbers and non-numbers\n (def q '(1a 1 0 2b e 3))\n (receive (nums other) (partition num? q)\n (print nums other)\n (newline))\n ; ↳ (1 0 3) (1a 2b e)" has? "Return `T` if the table has a value associated with the key, `NIL` otherwise.\n\nExamples:\n\n (def t #table(a 1 b 2))\n (has? t 'c)\n ; ↳ NIL\n (has? t 'a)\n ; ↳ T" vec "Construct a vector containing the specified arguments.\n\nExamples:\n\n (vec) ; empty vector\n ; ↳ #()\n\n (vec 1 2.5 \"a\" 'b)\n ; ↳ #(1 2.5 \"a\" b)" while "Evaluate the body expressions until `cond` evaluates to `NIL`.\n\nExamples:\n\n (def x 3)\n (while (> x 0)\n (princ #\\x)\n (set! x (1- x)))\n ; ‼ xxx" rune "Construct a rune from a Unicode code point. Without code point\nspecified, an \"invalid\" rune is returned." *exit-hooks* "Internal variable, a list containing functions to call right before VM\nprocess exits." cadar "Shorthand for (car (cdr (car lst)))." type-error "Raise a type error exception." file "Open a file for I/O.\n\nAn `io` object is returned. Without any modes specified the file\nmust already exist and is opened in read-only mode.\n\nFiles are created with the default mode bits #o644." nth "Return nth element of the list, or `NIL` if the list is shorter.\n\nExamples:\n\n (def l '(a b c))\n (nth l 0)\n ; ↳ a\n (nth l 2)\n ; ↳ c\n (nth l 10)\n ; ↳ NIL" cdr "Return the second element of a cons cell (tail of a list) or `NIL` if\nnot available.\n\nExamples:\n\n (cdr NIL)\n ; ↳ NIL\n\n (cdr '(1 2 3))\n ; ↳ (2 3)\n\n (cdr '(1 . 2))\n ; ↳ 2" / "Return the division of the arguments. With only one argument the\nresult of `1/x` is returned. If the result is integer-valued, it is\nreturned as an integer.\n\nExamples:\n\n (/ 2)\n ; ↳ 0.5\n\n (/ 7 2 2)\n ; ↳ 1.75\n\n (/ 10 -2)\n ; ↳ -5 ; a fixnum\n\n (/ 6.9 1.9)\n ; ↳ 3.6315…" newline "Write a single OS-specific line feed to the output.\n\nOn most systems it's a single character - `#\\linefeed` (`\\n`)." separate-doc-from-body "Take a list of terms and return a pair `(doc . body)`, where the first\nelement contains a list of documentation-related terms, and the second\ncontains the rest of the terms." 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¹" (doc81group syntax) "StreetLISP syntax and macros." defdoc "Define documentation for a top level term.\n\nIf `term` is a function signature and `doc` is not specified, just\nthe signature will be included in the documentation, without\nreplacing any previously defined.\n\nFirst `doc` argument is supposed to be a string with the description\nof the term. The following arguments are expected to be optional tag\npairings that provide grouping for multiple symbols and \"see also\"\nreferences.\n\nUseful in cases where setting the documentation for a term can't\n(or not preferred to) be done during the definition of said term.\nOne of those reasons could be that the term is a built-in function\nimplemented in C.\n\nExamples:\n\n (defdoc (func arg (arg2 0))\n \"Return something about the `arg` and `arg2`. This is a short\n description.\n\n This is the longer description, following the short one.\n\n Examples:\n\n (func 0)\n ; ↳ T\n\n (func 1 3)\n ; ↳ NIL\"\n :doc-group stuff\n :doc-see func2)\n (defdoc (func arg (:another-variant NIL)))" cdddr "Shorthand for (cdr (cdr (cdr lst)))." copy-table "Return a new copy of the table with the keys and values preserved.\n\nNo copies of the keys nor values are created - original ones are\nreused.\n\nExamples:\n\n (def t #table(a (1 2 3)))\n (def q (copy-table t))\n (eq? t q)\n ; ↳ NIL\n (eq? (get t 'a) (get q 'a))\n ; ↳ T" set-car! "Modify a cons cell (a list) in-place by putting `new-first` as its\nfirst element (head of the list). Return the modified cons\ncell (list).\n\nExamples:\n\n (def q '(1 2 3 4 5))\n (set-car! q 0)\n ; ↳ (0 6 7)\n q\n ; ↳ (0 6 7)" partition "Return two lists where the first contains the elements of the original\nlist which satisfy the predicate and the second containing the rest of\nthe elements.\n\nBoth lists will have the elements appear in the same order as in the\noriginal list.\n\nExamples:\n\n ; split the list into numbers and non-numbers\n (def q '(1a 1 0 2b e 3))\n (receive (nums other) (partition num? q)\n (print nums other)\n (newline))\n ; ↳ (1 0 3) (1a 2b e)" has? "Return `T` if the table has a value associated with the key, `NIL` otherwise.\n\nExamples:\n\n (def t #table(a 1 b 2))\n (has? t 'c)\n ; ↳ NIL\n (has? t 'a)\n ; ↳ T" vec "Construct a vector containing the specified arguments.\n\nExamples:\n\n (vec) ; empty vector\n ; ↳ #()\n\n (vec 1 2.5 \"a\" 'b)\n ; ↳ #(1 2.5 \"a\" b)" while "Evaluate the body expressions until `cond` evaluates to `NIL`.\n\nExamples:\n\n (def x 3)\n (while (> x 0)\n (princ #\\x)\n (set! x (1- x)))\n ; ‼ xxx" rune "Construct a rune from a Unicode code point. Without code point\nspecified, an \"invalid\" rune is returned." *exit-hooks* "Internal variable, a list containing functions to call right before VM\nprocess exits." cadar "Shorthand for (car (cdr (car lst)))." type-error "Raise a type error exception." file "Open a file for I/O.\n\nAn `io` object is returned. Without any modes specified the file\nmust already exist and is opened in read-only mode.\n\nFiles are created with the default mode bits #o644." nth "Return nth element of the list, or `NIL` if the list is shorter.\n\nExamples:\n\n (def l '(a b c))\n (nth l 0)\n ; ↳ a\n (nth l 2)\n ; ↳ c\n (nth l 10)\n ; ↳ NIL" cdr "Return the second element of a cons cell (tail of a list) or `NIL` if\nnot available.\n\nExamples:\n\n (cdr NIL)\n ; ↳ NIL\n\n (cdr '(1 2 3))\n ; ↳ (2 3)\n\n (cdr '(1 . 2))\n ; ↳ 2" / "Return the division of the arguments. With only one argument the\nresult of `1/x` is returned. If the result is integer-valued, it is\nreturned as an integer.\n\nExamples:\n\n (/ 2)\n ; ↳ 0.5\n\n (/ 7 2 2)\n ; ↳ 1.75\n\n (/ 10 -2)\n ; ↳ -5 ; a fixnum\n\n (/ 6.9 1.9)\n ; ↳ 3.6315…" newline "Write a single OS-specific line feed to the output.\n\nOn most systems it's a single character - `#\\linefeed` (`\\n`)." separate-doc-from-body "Take a list of terms and return a pair `(doc . body)`, where the first\nelement contains a list of documentation-related terms, and the second\ncontains the rest of the terms." 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
82group debug) "Debugging utilities." caaaar "Shorthand for (car (car (car (car lst))))." io-column "Return the current absolute position within the IO object in number of\ncolumns, optionally changing it first.\n\nColumn number is only applicable to files opened for reading. If\nposition is changed with `io-skip` or `io-pos`, the behavior is\nundefined." 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" (doc82group debug) "Debugging utilities." caaaar "Shorthand for (car (car (car (car lst))))." io-column "Return the current absolute position within the IO object in number of\ncolumns, optionally changing it first.\n\nColumn number is only applicable to files opened for reading. If\nposition is changed with `io-skip` or `io-pos`, the behavior is\nundefined." 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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

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

Repository code

Go to file
t