| @@ -28,7 +28,7 @@ new-name)) random ((max)) reverse! ((lst)) eval ((x)) cdaadr ((lst)) u32 (( · 27 unmodified lines |
| 28 | 28 | second)) filter ((pred lst)) assq ((key lst)) del! ((table key)) when ((cond . body)) vec? ((v)) min ((v . rest)) cddaar ((lst)) num->str ((n |
| 29 | 29 | (:base 10))) io? ((term)) eof-object? ((v)) help ((topic (:print-header help-print-header) . rest)) mod ((a |
| 30 | 30 | n)) if ((cond then else)) p32 (((n 0))) io-read-lines ((io)) io-line ((io)) sym-set-doc ((symbol |
| 31 | | −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 |
| 31 | +doc-seq . formals-list)) macrocall? ((e)) trycatch ((try catch)) iterate ((fn zero n)) table-values ((ta)) macroexpand ((e)) caadr ((lst)) type-of ((v)) top-level-value ((sym)) defstruct ((name |
| 32 | 32 | docs… options… (slot-1 DEFAULT) slot-2 slot-3) |
| 33 | 33 | (name (:type vec) (:named T) (:constructor T) (:conc-name T) (:predicate T) . slots)) caadar ((lst)) foldl1 ((fn |
| 34 | 34 | 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 |
| @@ -64,9 +64,9 @@ finally)) cos ((r)) io-skip ((io offset (:end NIL))) every ((pred lst)) atom · 29 unmodified lines |
| 64 | 64 | 0))) str-utf8? ((s)) apply ((f arg . rest)) cddr ((lst)) not ((v)) print (args) cdar ((lst)) cdaar ((lst)) iota ((count |
| 65 | 65 | (start 0) (step 1))) caaddr ((lst)) environment (NIL) getprop ((symbol key (def NIL))) putprop ((symbol |
| 66 | 66 | key val)) * (rest) rand-f32 (NIL) repl (NIL) io-read-until ((io r)) get ((table key (failed-result))) table? ((v)) u16 (((n |
| 67 | | −0))) logxor (ints) acos ((x)) time->str ((sec)) caddr ((lst)) to-proper ((lst)) nestlist ((fn |
| 68 | | −zero n)) table-keys ((ta)) catch ((tag expr)) __start ((argv interactive)) floor ((x)) add-exit-hook ((fn)) str-join ((strlist |
| 69 | | −sep)) >= ((v . rest)) lognot ((int)) void? ((v)) length= ((seq n)) int? ((v)) nanoseconds-monotonic (NIL) with-input-from ((io . body)) car ((lst)) <= ((v . rest)) ceiling ((x)) arr ((type . rest)) length> ((seq |
| 67 | +0))) logxor (ints) acos ((x)) time->str ((sec)) caddr ((lst)) to-proper ((lst)) table-keys ((ta)) catch ((tag |
| 68 | +expr)) __start ((argv interactive)) floor ((x)) add-exit-hook ((fn)) str-join ((strlist sep)) >= ((v . rest)) lognot ((int)) void? ((v)) length= ((seq |
| 69 | +n)) int? ((v)) nanoseconds-monotonic (NIL) with-input-from ((io . body)) car ((lst)) <= ((v . rest)) ceiling ((x)) arr ((type . rest)) length> ((seq |
| 70 | 70 | n)) arg-error (msg) asin ((x)) put! ((table key value)) log ((x (base (exp 1)))) cdaddr ((lst)) ash ((int |
| 71 | 71 | nbits)) str-sub ((s start (end NIL))) cddadr ((lst)) memv ((item lst)) max ((v . rest)) closure? ((v)) read-all ((io)) rand-f64 (NIL) help-print-header ((term |
| 72 | 72 | sigs (:kind NIL) (:lpad ""))) sleep ((sec)) s16 (((n 0))) rune? ((v)) os-setenv ((name value)) __script ((path))) *doc* #table(append "Return the concatenation of the arguments.\n\nLists are copied, except the last one, which becomes the `cdr` of the\nfinal dotted pair. It's returned as is if it was the only argument.\nNo lists are changed in-place.\n\nExamples:\n\n (append '(1) '(2 3) '(4))\n ; ↳ (1 2 3 4)\n\n (append '(1))\n ; ↳ (1)" (doc |
| @@ -75,7 +75,7 @@ group string) "Strings and runes." sort "Return a copy of the list sorted by co · 2 unmodified lines |
| 75 | 75 | 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 |
| 76 | 76 | 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 exception.\n\nExamples:\n\n (const? 12345) ; a number\n ; ↳ T\n\n (const? 'const?) ; a function\n ; ↳ NIL\n\n (const? 'pi) ; a mathematical constant\n ; ↳ T" str-trim "Return the portion of the string with all leading runes satisfying\n`lead-pred` (and trailing runes satisfying `trail-pred`) removed.\n\nWithout predicates explicitly specified, `str-trim` will remove\nwhitespace from both sides of the string.\n\nPass `NIL` as the predicate to disable trimming on either side.\n\nExamples:\n\n (str-trim \" \\nhello\\t\\v\")\n ; ↳ \"hello\"\n\n (str-trim \" \\nhello\\t\\v\"\n (λ (r) (str-find \" \\v\" r)))\n ; ↳ \"\\nhello\\t\"\n\n (str-trim \"123abc!456def\"\n rune-numeric?\n rune-alphabetic?)\n ; ↳ \"abc!456\"" io-pos! "Change the current absolute position within the IO object in bytes,\nreturn the resulting position.\n\nExamples:\n\n (def f (buffer))\n (io-write f \"hello, world!\")\n (io-pos! f 64)\n ; ↳ 13\n (io-pos! f 7)\n ; ↳ 7\n (read f)\n ; ↳ world!" return "Return from the function with the specified value as the result.\n\nExamples:\n\n (def (f x) (when (not x)\n (return 0))\n (princ \"hi\")\n (newline)\n 1)\n (f 'a)\n ; ‼ hi\n ; ↳ 1\n (f NIL)\n ; ↳ 0" *stderr* "Standard error output IO stream." tan "Return the tangent of `r`, where `r` is given in radians." table "Construct a table from keys from the arguments.\n\nEvery two arguments are expected to be a key and a value associated\nwith that key.\n\nExamples:\n\n (table)\n ; ↳ #table()\n\n (table 'a 1 'b 2)\n ; ↳ #table(a 1 b 2)" __rcscript "Execute, if exists, the user's \"run commands\" file.\n\nThe file path is predefined and depends on the OS:\n\n * `$home/lib/slrc` on Plan 9\n * `$HOME/.slrc` on other operating systems\n\nIt is automatically loaded by StreetLISP when running in interactive\nmode. The user may wish to use this file to change the look of the\nprompt, load additional functionality they want to use without having\nto do the process manually each time, and so on." doc-group "Define documentation for a group." cdaaar "Shorthand for (cdr (car (car (car lst))))." bounds-error "Raise a bounds error exception." even? "Return `T` if `n` is an even integer, `NIL` otherwise." *properties* "All properties of symbols recorded with `putprop` are recorded in this\ntable." zero? "Return `T` if `n` is zero. Shorthand for `(= n 0)`." proper-list? "Return `T` is the value is a proper list. That is, a non-circular\nlist with the last element being `NIL`, as opposed to a dotted list.\n\nExamples:\n\n ; empty list\n (proper-list? NIL)\n ; ↳ T\n\n ; a list with one element\n (proper-list? '(1))\n ; ↳ T\n\n ; a pair, cdr of the cell is 2\n (proper-list? '(1 . 2))\n ; ↳ NIL\n\n ; on a circular list\n (def l '(1))\n (set-cdr! l l)\n ; ↳ #0=(1 . #0#)\n (length l)\n ; ↳ +inf.0\n (proper-list? l)\n ; ↳ NIL" io-filename! "Change the filename of the IO object, return the new filename.\n\nChanging the filename does not cause any side effects. The filename\nis purely informative and does not necessarily reflect the actual\npath.\n\nExamples:\n\n (def f (buffer))\n (io-filename b)\n ; ↳ \"\"\n (io-filename! b \"new name\") ; change the filename\n ; ↳ \"new name\"\n (io-filename b)\n ; ↳ \"new name\"" 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" *directory-separator* "OS-specific path separator.\n\nIt is preferred over hardcoded `\"/\"`, for portability." reverse! "Return the list with its elements in reverse order.\n\nThe original list may be modified by this function since it's a\ndestructive operation.\n\nExamples:\n\n (def a '(1 2 3))\n (reverse! a)\n ; ↳ (3 2 1)\n a\n ; ↳ (1) ; original list has been modified in-place" eval "Evaluate expression.\n\nExamples:\n\n (eval '(begin (set! x 1 y 2) (+ x y)))\n ; ↳ 3\n x\n ; ↳ 1\n y\n ; ↳ 2" cdaadr "Shorthand for (cdr (car (car (cdr lst))))." u32 "Construct a 32-bit unsigned number." cons "Return a cons cell containing two arguments.\n\nExamples:\n\n (cons 1 2)\n ; ↳ (1 . 2)\n\n (cons 1 '(2))\n ; ↳ (1 2)\n\n (cons 1 (cons 2 (cons 3 NIL)))\n ; ↳ (1 2 3)" filter "Return a copy of the list with only the elements of the original\nthat satisfy the predicate.\n\nExamples:\n\n (filter odd? '(0 1 2 3 4))\n ; ↳ (1 3)" 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 order\nto list the matching terms defined in the current environment. This\ncan be useful to recall a function's name.\n\nExamples:\n\n (help str?) ; show documentation for str?\n (help groups) ; show documentation groups\n (help type group) ; list items for dealing with types\n (help group type) ; same as ^\n (help str->*) ; find functions converting from strings\n (help *->str) ; find functions converting to strings\n (help *num*) ; find anything related to numbers" (doc |
| 77 | 77 | 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\")" io-line "Return the current line number of the IO object.\n\nLine number is purely informative and is only being automatically\nupdated with the files opened for reading. If the cursor position is\nchanged via `io-skip` or `io-pos!`, the behavior is undefined." sym-set-doc "Set the documentation for the symbol." macrocall? "Return the macro application function if `e` refers to a macro call,\n`NIL` otherwise.\n\nExamples:\n\n (macrocall? '(car NIL))\n ; ↳ NIL\n\n (macrocall? '(let ((x 1)) 2))\n ; ↳ #fn(...)" trycatch "Return the result of evaluation of the expression `try` or, if an\nexception has been thrown, the one-argument function `catch`.\n\nExamples:\n\n (trycatch (+ 1 2) (λ (e) e))\n ; ↳ 3\n (trycatch (+ 1 NIL) (λ (e) e))\n ; ↳ (type-error num NIL)" (doc |
| 78 | | −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 ; (blah-a! s new-a)\n ; (blah-b! s new-b)\n\nSlot's options, if any, should be specified after its default value.\nSupported options are:\n\n ; mark the slot as read-only\n ; its value can be read, but trying to modify it will throw an error\n … :read-only T\n\nThe constructor can be changed in several ways:\n\n ; disable the constructor altogether\n (defstruct blah :constructor NIL a b c)\n ; only change its name\n (defstruct blah :constructor blargh a b c)\n ; rename AND avoid using keywords\n (defstruct blah :constructor (blah a b c) a b c)\n\nThe option `:conc-name` specifies the slot accessor/setter prefix,\nwhich defaults to `structname-`. Prefix can be disabled entirely with\n`:conc-name NIL`.\n\nSlot setters are generated for writable slots by appending `!`\n(exclamation mark) to the accessor's name.\n\nDefault predicate can be disabled or its name, which defaults to\n`structname?`, changed:\n\n ; use \"blargh?\" instead of \"blah?\"\n (defstruct blah :predicate blargh? a b c)\n ; without predicate\n (defstruct blah :predicate NIL a b c)" caadar "Shorthand for (car (car (cdr (car lst))))." foldl1 "Same as `foldl` but using the first element of the list as the\ninitial accumulator.\n\nExamples:\n\n (foldl1 * (iota 6 1))\n ; ↳ 720" buffer "Return an in-memory buffer for I/O, of `io` type.\n\nA buffer can be used for both reading and writing at the same\ntime." assoc-list "Construct an association list from the arguments.\n\nEvery two arguments are expected to be a key and a value associated\nwith that key.\n\nExamples:\n\n (assoc-list 'a 0 'b 1)\n ; ↳ ((a . 0) (b . 1))" builtin? "Return `T` if `v` is a built-in function implemented in C, `NIL`\notherwise.\n\nExamples:\n\n (builtin? map)\n ; ↳ T\n\n (builtin? macroexpand)\n ; ↳ NIL" str-map "Return the concatenation of the values produced by `fn` when applying\nto each rune of the string `s`.\n\nFunction `fn` may return a value of any type suitable for `io-write` -\na rune, string, array of C primitives. If `fn` returns `NIL`, the\nrune is ignored.\n\nExamples:\n\n (str-map rune-upcase\n \"hello, world!\")\n ; ↳ \"HELLO, WORLD!\"\n\n (str-map (λ (r) (str r r))\n \"hello\")\n ; ↳ \"hheelllloo\"\n\n (str-map (λ (r) (and (not (rune-whitespace? r)) r))\n \"! this is great !\")\n ; ↳ \"!thisisgreat!\"" macroexpand-1 "Return a macro-expanded expression.\n\nIf the expression is not a macro call, it is returned unchanged.\nOnly a single level of expansion is performed.\n\nExamples:\n\n (let ((a 3) (b 4) (c 5))\n (macroexpand-1 `(let* {[x ,a] [y ,b]} (+ x y ,c))))\n ; ↳ ((λ (x) ; note how the inner let* expression isn't expanded\n (let* ((y 4)) (+ x y 5)))\n 3)" str "Return concatenation of terms formatted as strings.\n\nThis is equivalent to `(princ terms…)`, except the string is\n_returned_, rather than printed.\n\nExamples:\n\n (str \"a\" 'b 1 #(0))\n ; ↳ \"ab1#(0)\"" negative? "Return `T` if `n` is a negative number. Shorthand for `(< n 0)`." void "Return the constant `#<void>` while ignoring any arguments.\n\n`#<void>` is mainly used when a function has side effects but does not\nproduce any meaningful value to return, so even though `T` or `NIL` could\nbe returned instead, in case of `#<void>` alone, REPL will not print\nit." assert-fail "Throw an \"assertion failed\" exception if evaluating `expr` itself does\nnot result in an exception thrown. Return `T` otherwise.\n\nTo test for a specific exception type, an optional `what` argument can\nbe used.\n\nExamples:\n\n (def s \"abc\")\n (assert-fail (= (length s) 3))\n ; ‼ assertion failed: ...\n (assert-fail (= s 1) type-error)\n ; ↳ T" io-read-line "Return a single line of input read from `io`.\n\nReading stops at either a `#\\linefeed` character or upon reaching EOF.\nThe line feed character is included in the returned value unless EOF\nhas been reached beforehand.\n\nEOF (`#<eof-object>`) is returned if the IO object had no data.\n\nExamples:\n\n ; read one line from the kernel messages file\n (io-read-line (file \"/dev/kmesg\"))\n ; ↳ \"127 holes free\\n\"\n\n ; /dev/null has no data - EOF is returned\n (eof-object? (io-read-line (file \"/dev/null\")))\n ; ↳ T" and "Return `NIL` and stop evaluating the arguments if one of them\nevaluated to `NIL`. Return the last value otherwise.\n\nExamples:\n\n (and)\n ; ↳ T\n\n (and 1 2 (print 'yes) 3)\n ; ‼ yes\n ; ↳ 3\n\n (and 1 NIL (print 'yes) 3)\n ; ↳ NIL" 1- "Equivalent to `(- n 1)` - decrement by one." 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 |
| 78 | +group builtin) "Built-in operators." iterate "Return the list of length `n` containing results of applying function\n`fn` to `zero`, 0 through `n` times.\n\nThe result is of form\n\n [zero (fn zero) (fn (fn zero)) (fn (fn (fn zero))) …]\n\nExamples:\n\n (iterate 1+ 5 3)\n ; ↳ (5 6 7)\n\n (iterate (λ (x) (* x x)) 2 5)\n ; ↳ (2 4 16 256 65536)\n\n (iterate (λ (s) (str-sub s 1)) \"hello\" 5)\n ; ↳ (\"hello\" \"ello\" \"llo\" \"lo\" \"o\")" *syntax-environment* "Table containing macro definitions.\n\nThe keys are macro names, the values are their application functions." table-values "Return the list of all values of the table.\n\nExamples:\n\n (def t #table(a 1 b 2 c 1))\n (table-values t)\n ; ↳ (1 2 1)" macroexpand "Return a fully macro-expanded expression.\n\nExpansion will continue until no more macro calls are left.\n\nExamples:\n\n (let ((a 3) (b 4) (c 5))\n (macroexpand `(let* {[x ,a] [y ,b]} (+ x y ,c))))\n ; ↳ ((λ (x)\n ((λ (y)\n (+ x y 5))\n 4))\n 3)" caadr "Shorthand for (car (car (cdr lst)))." type-of "Return the underlying type of the value.\n\nExamples:\n\n (type-of 1)\n ; ↳ fixnum\n\n (type-of NIL)\n ; ↳ null\n\n (type-of T)\n ; ↳ bool\n\n (type-of \"hello\")\n ; ↳ str\n\n (type-of (arr 'u32 0 1 2))\n ; ↳ (arr u32)" top-level-value "Return the value bound to the symbol in the top level (global)\nenvironment.\n\nExamples:\n\n (def abc 1)\n (let {[abc 2]}\n (cons abc (top-level-value 'abc)))\n ; ↳ (2 . 1)\n abc\n ; ↳ 1" defstruct "Declare a new structure type with the specified name and slots.\n\nThe default underlying type is a \"named\" vector (`:type vec`), where\nthe first element is the name of the structure's type, the rest are\nthe keyworded slot values. A list with slot values alone can be used\ninstead by adding `:type list` option. The list will not contain the\nname of the struct by default, which can be enabled with `:named T`\noption.\n\nAs an example, the following declaration generates the default\nconstructor for a structure of three slots, with one of them (`c`)\nhaving a non-`NIL` default value and marked as read-only:\n\n (defstruct blah \"Return stuff.\" :doc-group stuff a b (c 1 :read-only T))\n ; (make-blah (:a NIL) (:b NIL) (:c 1))\n ; (blah-a s)\n ; (blah-b s)\n ; (blah-c s)\n ; (blah-a! s new-a)\n ; (blah-b! s new-b)\n\nSlot's options, if any, should be specified after its default value.\nSupported options are:\n\n ; mark the slot as read-only\n ; its value can be read, but trying to modify it will throw an error\n … :read-only T\n\nThe constructor can be changed in several ways:\n\n ; disable the constructor altogether\n (defstruct blah :constructor NIL a b c)\n ; only change its name\n (defstruct blah :constructor blargh a b c)\n ; rename AND avoid using keywords\n (defstruct blah :constructor (blah a b c) a b c)\n\nThe option `:conc-name` specifies the slot accessor/setter prefix,\nwhich defaults to `structname-`. Prefix can be disabled entirely with\n`:conc-name NIL`.\n\nSlot setters are generated for writable slots by appending `!`\n(exclamation mark) to the accessor's name.\n\nDefault predicate can be disabled or its name, which defaults to\n`structname?`, changed:\n\n ; use \"blargh?\" instead of \"blah?\"\n (defstruct blah :predicate blargh? a b c)\n ; without predicate\n (defstruct blah :predicate NIL a b c)" caadar "Shorthand for (car (car (cdr (car lst))))." foldl1 "Same as `foldl` but using the first element of the list as the\ninitial accumulator.\n\nExamples:\n\n (foldl1 * (iota 6 1))\n ; ↳ 720" buffer "Return an in-memory buffer for I/O, of `io` type.\n\nA buffer can be used for both reading and writing at the same\ntime." assoc-list "Construct an association list from the arguments.\n\nEvery two arguments are expected to be a key and a value associated\nwith that key.\n\nExamples:\n\n (assoc-list 'a 0 'b 1)\n ; ↳ ((a . 0) (b . 1))" builtin? "Return `T` if `v` is a built-in function implemented in C, `NIL`\notherwise.\n\nExamples:\n\n (builtin? map)\n ; ↳ T\n\n (builtin? macroexpand)\n ; ↳ NIL" str-map "Return the concatenation of the values produced by `fn` when applying\nto each rune of the string `s`.\n\nFunction `fn` may return a value of any type suitable for `io-write` -\na rune, string, array of C primitives. If `fn` returns `NIL`, the\nrune is ignored.\n\nExamples:\n\n (str-map rune-upcase\n \"hello, world!\")\n ; ↳ \"HELLO, WORLD!\"\n\n (str-map (λ (r) (str r r))\n \"hello\")\n ; ↳ \"hheelllloo\"\n\n (str-map (λ (r) (and (not (rune-whitespace? r)) r))\n \"! this is great !\")\n ; ↳ \"!thisisgreat!\"" macroexpand-1 "Return a macro-expanded expression.\n\nIf the expression is not a macro call, it is returned unchanged.\nOnly a single level of expansion is performed.\n\nExamples:\n\n (let ((a 3) (b 4) (c 5))\n (macroexpand-1 `(let* {[x ,a] [y ,b]} (+ x y ,c))))\n ; ↳ ((λ (x) ; note how the inner let* expression isn't expanded\n (let* ((y 4)) (+ x y 5)))\n 3)" str "Return concatenation of terms formatted as strings.\n\nThis is equivalent to `(princ terms…)`, except the string is\n_returned_, rather than printed.\n\nExamples:\n\n (str \"a\" 'b 1 #(0))\n ; ↳ \"ab1#(0)\"" negative? "Return `T` if `n` is a negative number. Shorthand for `(< n 0)`." void "Return the constant `#<void>` while ignoring any arguments.\n\n`#<void>` is mainly used when a function has side effects but does not\nproduce any meaningful value to return, so even though `T` or `NIL` could\nbe returned instead, in case of `#<void>` alone, REPL will not print\nit." assert-fail "Throw an \"assertion failed\" exception if evaluating `expr` itself does\nnot result in an exception thrown. Return `T` otherwise.\n\nTo test for a specific exception type, an optional `what` argument can\nbe used.\n\nExamples:\n\n (def s \"abc\")\n (assert-fail (= (length s) 3))\n ; ‼ assertion failed: ...\n (assert-fail (= s 1) type-error)\n ; ↳ T" io-read-line "Return a single line of input read from `io`.\n\nReading stops at either a `#\\linefeed` character or upon reaching EOF.\nThe line feed character is included in the returned value unless EOF\nhas been reached beforehand.\n\nEOF (`#<eof-object>`) is returned if the IO object had no data.\n\nExamples:\n\n ; read one line from the kernel messages file\n (io-read-line (file \"/dev/kmesg\"))\n ; ↳ \"127 holes free\\n\"\n\n ; /dev/null has no data - EOF is returned\n (eof-object? (io-read-line (file \"/dev/null\")))\n ; ↳ T" and "Return `NIL` and stop evaluating the arguments if one of them\nevaluated to `NIL`. Return the last value otherwise.\n\nExamples:\n\n (and)\n ; ↳ T\n\n (and 1 2 (print 'yes) 3)\n ; ‼ yes\n ; ↳ 3\n\n (and 1 NIL (print 'yes) 3)\n ; ↳ NIL" 1- "Equivalent to `(- n 1)` - decrement by one." 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 |
| 79 | 79 | 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 |
| 80 | 80 | 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 |
| 81 | 81 | group time) "Measuring, manipulating and displaying time." copy-tree "Return a recursive copy of the list.\n\nUnlike `copy-list`, this function copies subelements of the list\nrecursively.\n\nExamples:\n\n (def a '(1 (2 3)))\n (def b (copy-tree a))\n (equal? a b)\n ; ↳ T\n (eq? a b)\n ; ↳ NIL\n (equal? (cadr a) (cadr b))\n ; ↳ T\n (eq? (cadr a) (cadr b))\n ; ↳ NIL" f32 "Construct a 32-bit floating point number." sin "Return the sine of `r`, where `r` is given in radians." io-copy "Copy bytes from the source IO object to the destination and return\nthe number of bytes copied. If `n` is provided, copy up to that many\nbytes." 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 ; ↳ #\\к" foldl "Reduce the list to a single value by repeatedly applying the function\nleft-associatively.\n\nThe function should be of the form `(fn elt acc)`, with `elt` being\nelements of the list and `acc` initially set to `zero` and subsequently\nto the previous value of the function application.\n\nThe result will be:\n\n (fn eₙ (…(fn e₁ (fn e₀ zero))…))\n\nNote that `foldl` is tail call recursive.\n\nExamples:\n\n (foldl cons NIL (iota 5))\n ; ↳ (4 3 2 1 0)\n\n (foldl + 0 (iota 5))\n ; ↳ 10" 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\")" io-read "Return a value of the specified type by reading it from the IO\nobject.\n\nThe `type` must specify a fixed-width number, pointer or rune.\n\nIf the parameter `n` is provided, read `n` values of the type,\nreturning an array of the values or a string when `type` is `utf8`.\n\nExamples:\n\n (io-read f 'utf8 5)\n ; ↳ \"hello\"\n\n (io-read f 'u32)\n ; ↳ 57\n\n (io-read f 'u32 3)\n ; ↳ #arr(u32 0 1 2)\n\n (io-read f 'rune 6)\n ; ↳ #arr(rune #\\λ #\\a #\\m #\\b #\\d #\\a)" 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))" io-column! "Change the current column number of the IO object." copy-list "Return a copy of the list.\n\nThe number of elements to be copied can be limited with the optional\nargument `n`.\n\nExamples:\n\n (def a '(1 2 3 4))\n (def b (copy-list a))\n b\n ; ↳ (1 2 3 4)\n (eq? a b)\n ; ↳ NIL\n (equal? a b)\n ; ↳ T\n (copy-list a 3)\n ; ↳ (1 2 3)\n (copy-list a 10)\n ; ↳ (1 2 3 4)" logand "Return the result of bitwise AND operation on integers.\n\nExamples:\n\n (logand)\n ; ↳ 0\n\n (logand 2)\n ; ↳ 2\n\n (logand 2 3)\n ; ↳ 2\n\n (logand 2 3 4)\n ; ↳ 0" time-now "Return the number of 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.\n\nExamples:\n\n (def f (buffer))\n (io-write f \"hello, world!\")\n (io-pos f)\n ; ↳ 13" 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 |
| @@ -87,7 +87,7 @@ group debug) "Debugging utilities." caaaar "Shorthand for (car (car (car (car l · 5 unmodified lines |
| 87 | 87 | 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))))." foldr1 "Same as `foldr` but using the first element of the list as the\ninitial accumulator.\n\nExamples:\n\n (foldr1 + (iota 10))\n ; ↳ 45" compare "Return -1 if `x` is less than `y`, 0 if equal, and `1` if `y` is\ngreater than `x`.\n\nExamples:\n\n (compare 'a 'b)\n ; ↳ -1\n\n (compare 1 1)\n ; ↳ 0\n\n (compare \"b\" \"a\")\n ; ↳ 1" 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 copy of the vector with the same elements.\n\nNo copies of the values themselves are created, the original values\nare reused.\n\nExamples:\n\n (def v #vec(1 2 \"three\"))\n (def q (copy-vec v))\n (eq? v q)\n ; ↳ NIL\n (equal? v q)\n ; ↳ T\n (map eq? v q)\n ; ↳ #(T T T)" *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\n\n (eqv? 0 0)\n ; ↳ T\n\n (def a \"1\")\n (def b \"1\")\n (eqv? a b)\n ; ↳ T\n\n (def a '(1))\n (def b '(1))\n (eqv? a b)\n ; ↳ NIL" list "Return a list constructed of the arguments.\n\nExamples:\n\n (list) ; empty list\n ; ↳ NIL\n\n (list 1 2.5 \"a\" 'b)\n ; ↳ (1 2.5 \"a\" b)" __init_globals "Initialize globals that need to be set at load time." rand-u32 "Return a random integer on interval [0, 2³²-1]." revappend "Return list with its elements in reverse order, with `tail` appended\nto its end.\n\nThe original list is copied to construct the reversed version.\n\nExamples:\n\n (def a '(4 5 6))\n (revappend a '(3 2 1))\n ; ↳ (6 5 4 3 2 1)\n a\n ; ↳ (4 5 6)" quote "Leave the expression unevaluated.\n\nShorthand for `(quote expr)`.\n\nExamples:\n\n '(0 1 (+ 2 3)) ; same as (quote (0 1 (+ 2 3)))\n ; ↳ (0 1 (+ 2 3))" nreconc "Return list with its elements in reverse order, with `tail` appended\nto its end.\n\nThe original list may be modified by this function.\n\nExamples:\n\n (def a '(4 5 6))\n (nreconc a '(3 2 1))\n ; ↳ (6 5 4 3 2 1)" defc*r "Define a shorthand for list access using `car` and `cdr`.\n\nExamples:\n\n (defc*r caaaaaaaaddr) ; define the function" (doc |
| 88 | 88 | 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 |
| 89 | 89 | 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 |
| 90 | | −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 "Update the current absolute position within the IO object by the\nrelative offset in bytes, return the resulting absolute position.\n\nTo specify the position relative to the end of the file, use the\noptional `:end T` argument with a negative offset.\n\nExamples:\n\n (def f (buffer))\n (io-write f \"hello, world!\")\n (io-skip f -6 :end T)\n ; ↳ 7\n (read f)\n ; ↳ world!" *io-in* "Current (default) input IO stream.\n\nFunctions may use `*io-in*` for input, which then can be redirected\nfrom a different IO using either `with-input-from` or (a more general)\n`with-bindings`." every "Return `T` if the predicate is true for _every_ element of the list,\n`NIL` otherwise.\n\nExample:\n\n ; is every number odd?\n (every odd? '(1 3 5 7))\n ; ↳ T\n\n ; is every string longer than one rune?\n (every (λ (s) (length> s 1))\n '(\"ab\" \"cd\" \"e\"))\n ; ↳ NIL" atom? "Return `T` if `v` is a _not_ a cons cell, `NIL` otherwise. This is\nthe opposite of `cons?`.\n\nThe term \"atom\" comes from the idea of being indivisible.\n\nExamples:\n\n (atom? \"a\")\n ; ↳ T\n\n (atom? NIL)\n ; ↳ T\n\n (atom? '(1))\n ; ↳ NIL" p64 "Construct a 64-bit abstract pointer value." str-utf8? "Return `T` if `s` is a valid UTF-8 string, `NIL` otherwise.\n\nExamples:\n\n (str-utf8? \"привет\")\n ; ↳ T\n\n (str-utf8? \"при\\xffвет\")\n ; ↳ NIL" apply "Return the result of applying a function `f` to a list of arguments.\n\nThe last argument must always be a list which gets spliced as\narguments to the function.\n\nExamples:\n\n (apply + 1 2 '(3 4 5))\n ; ↳ 15\n\n (apply vec '(1 2 3))\n ; ↳ #(3 4 5)\n\n (apply arr 'u8 '(3 4 5))\n ; ↳ #vu8(3 4 5)" cddr "Shorthand for (cdr (cdr lst))." not "Return `T` if `v` is `NIL`, `T` otherwise." print "Print the arguments to *io-out* with `*print-readably*` set to `T`.\n\nMultiple arguments are separated with a single `#\\space`.\n\nExamples:\n\n (print 1 2 \"abc\")\n ; ‼ 1 2 \"abc\"" cdar "Shorthand for (cdr (car lst))." cdaar "Shorthand for (cdr (car (car lst)))." iota "Return a list of generated indices.\n\nThe sequence of numbers generated will contain the elements\n\n (start start+step … start+(count-1)*step)\n\nExamples:\n\n (iota 4)\n ; ↳ (0 1 2 3)\n\n (iota 4 6)\n ; ↳ (6 7 8 9)\n\n (iota 4 6 -0.5)\n ; ↳ (6 5.5 5.0 4.5)" caaddr "Shorthand for (car (car (cdr (cdr lst))))." environment "Return the list of all bound top level symbols." getprop "Return a property value associated with the symbol or `def` if\nmissing.\n\nIf the default value is not supplied and the property is missing,\nan exception will be thrown." 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." io-read-until "Return a string by reading from the IO object until encountering the\ndelimiting rune `r`. The returned string includes the delimiter." get "Return the value associated with the `key` in the table.\n\nIf the key isn't in the table then either return the optional\n`failed-result` argument or (if called without the argument) throw a\n`key-error` exception.\n\nExamples:\n\n (def t #table(a 1 b 2))\n (get t 'a)\n ; ↳ 1\n (get t 'b NIL)\n ; ↳ 2\n (get t 'c)\n ; ‼ key not found: a\n (get t 'c 123)\n ; ↳ 123" table? "Return `T` if the argument is a table, `NIL` otherwise." u16 "Construct a 16-bit unsigned number." logxor "Return the result of bitwise XOR (exclusive OR) operation on integers.\n\nExamples:\n\n (logxor)\n ; ↳ 0\n\n (logxor 2)\n ; ↳ 2\n\n (logxor 2 3)\n ; ↳ 1\n\n (logxor 2 3 4)\n ; ↳ 5" 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 |
| 90 | +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 "Update the current absolute position within the IO object by the\nrelative offset in bytes, return the resulting absolute position.\n\nTo specify the position relative to the end of the file, use the\noptional `:end T` argument with a negative offset.\n\nExamples:\n\n (def f (buffer))\n (io-write f \"hello, world!\")\n (io-skip f -6 :end T)\n ; ↳ 7\n (read f)\n ; ↳ world!" *io-in* "Current (default) input IO stream.\n\nFunctions may use `*io-in*` for input, which then can be redirected\nfrom a different IO using either `with-input-from` or (a more general)\n`with-bindings`." every "Return `T` if the predicate is true for _every_ element of the list,\n`NIL` otherwise.\n\nExample:\n\n ; is every number odd?\n (every odd? '(1 3 5 7))\n ; ↳ T\n\n ; is every string longer than one rune?\n (every (λ (s) (length> s 1))\n '(\"ab\" \"cd\" \"e\"))\n ; ↳ NIL" atom? "Return `T` if `v` is a _not_ a cons cell, `NIL` otherwise. This is\nthe opposite of `cons?`.\n\nThe term \"atom\" comes from the idea of being indivisible.\n\nExamples:\n\n (atom? \"a\")\n ; ↳ T\n\n (atom? NIL)\n ; ↳ T\n\n (atom? '(1))\n ; ↳ NIL" p64 "Construct a 64-bit abstract pointer value." str-utf8? "Return `T` if `s` is a valid UTF-8 string, `NIL` otherwise.\n\nExamples:\n\n (str-utf8? \"привет\")\n ; ↳ T\n\n (str-utf8? \"при\\xffвет\")\n ; ↳ NIL" apply "Return the result of applying a function `f` to a list of arguments.\n\nThe last argument must always be a list which gets spliced as\narguments to the function.\n\nExamples:\n\n (apply + 1 2 '(3 4 5))\n ; ↳ 15\n\n (apply vec '(1 2 3))\n ; ↳ #(3 4 5)\n\n (apply arr 'u8 '(3 4 5))\n ; ↳ #vu8(3 4 5)" cddr "Shorthand for (cdr (cdr lst))." not "Return `T` if `v` is `NIL`, `T` otherwise." print "Print the arguments to *io-out* with `*print-readably*` set to `T`.\n\nMultiple arguments are separated with a single `#\\space`.\n\nExamples:\n\n (print 1 2 \"abc\")\n ; ‼ 1 2 \"abc\"" cdar "Shorthand for (cdr (car lst))." cdaar "Shorthand for (cdr (car (car lst)))." iota "Return a list of generated indices.\n\nThe sequence of numbers generated will contain the elements\n\n (start start+step … start+(count-1)*step)\n\nExamples:\n\n (iota 4)\n ; ↳ (0 1 2 3)\n\n (iota 4 6)\n ; ↳ (6 7 8 9)\n\n (iota 4 6 -0.5)\n ; ↳ (6 5.5 5.0 4.5)" caaddr "Shorthand for (car (car (cdr (cdr lst))))." environment "Return the list of all bound top level symbols." getprop "Return a property value associated with the symbol or `def` if\nmissing.\n\nIf the default value is not supplied and the property is missing,\nan exception will be thrown." 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." io-read-until "Return a string by reading from the IO object until encountering the\ndelimiting rune `r`. The returned string includes the delimiter." get "Return the value associated with the `key` in the table.\n\nIf the key isn't in the table then either return the optional\n`failed-result` argument or (if called without the argument) throw a\n`key-error` exception.\n\nExamples:\n\n (def t #table(a 1 b 2))\n (get t 'a)\n ; ↳ 1\n (get t 'b NIL)\n ; ↳ 2\n (get t 'c)\n ; ‼ key not found: a\n (get t 'c 123)\n ; ↳ 123" table? "Return `T` if the argument is a table, `NIL` otherwise." u16 "Construct a 16-bit unsigned number." logxor "Return the result of bitwise XOR (exclusive OR) operation on integers.\n\nExamples:\n\n (logxor)\n ; ↳ 0\n\n (logxor 2)\n ; ↳ 2\n\n (logxor 2 3)\n ; ↳ 1\n\n (logxor 2 3 4)\n ; ↳ 5" 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)" 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 |
| 91 | 91 | 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` which must be\na fixed-width number or pointer type, or rune.\n\nExamples:\n\n (arr 's8 0 1 2)\n ; ↳ #arr(s8 0 1 2)\n\n (arr 'rune 0 1 2)\n ; ↳ #arr(rune #\\nul #\\soh #\\stx)" <= "Return `T` if the arguments are in non-decreasing order (previous\none is less than or equal to the next one)." length> "Perform a bounded length test and return `T` if the length is greater\nthan `n`, `NIL` otherwise.\n\nUse this instead of `(> (length seq) n)`, since it avoids unnecessary\nwork and always terminates.\n\nThe value of `seq` can be of any sequence type." arg-error "Raise an argument error exception." asin "Return the arc sine of `x` in radians." put! "Store the value associated with the key and return the table.\n\nAny existing value associated with the key will be replaced.\n\nExamples:\n\n (def t #table(a 1 b 2))\n (put! t 'c 3)\n ; ↳ #table(c 3 b 2 a 1)\n (put! t 'a \"hello\")\n ; ↳ #table(c 3 b 2 a \"hello\")" log "Return the logarithm of `x` in `base`.\n\nDefault base is `e`, returning natural logarithm of the first\nargument.\n\nExamples:\n\n (log 100 10)\n ; ↳ 2.0\n\n (log 256 2)\n ; ↳ 8.0\n\n (log (exp 4))\n ; ↳ 4.0" (doc |
| 92 | 92 | 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) |
| 93 | 93 | (:doc-see . nconc) (:doc-see . revappend)) io-eof? ((:doc-group . io)) path-exists? ((:doc-group . io) |
| @@ -132,7 +132,7 @@ group number) "Operations on numbers, mathematical constants." cdaddr "Shorthan · 38 unmodified lines |
| 132 | 132 | (:doc-see . div) (:doc-see . mod0)) if ((:doc-group . syntax) (:doc-see . when) (:doc-see . unless)) p32 ((:doc-group . number) |
| 133 | 133 | (:doc-see . p64) (:doc-see . ptr)) io-read-lines ((:doc-group . io) (:doc-see . io-read-line) (:doc-see . io-read-all)) io-line ((:doc-group . io) |
| 134 | 134 | (:doc-see . io-column) (:doc-see . io-line!)) sym-set-doc ((:doc-group . doc)) macrocall? ((:doc-group . syntax) |
| 135 | | −(:doc-see . macroexpand-1) (:doc-see . macroexpand)) trycatch ((:doc-group . syntax) (:doc-see . unwind-protect)) *syntax-environment* ((:doc-group . syntax) |
| 135 | +(:doc-see . macroexpand-1) (:doc-see . macroexpand)) trycatch ((:doc-group . syntax) (:doc-see . unwind-protect)) iterate ((:doc-group . list)) *syntax-environment* ((:doc-group . syntax) |
| 136 | 136 | (:doc-see . get-syntax) (:doc-see . set-syntax!)) table-values ((:doc-group . table) (:doc-see . table-keys)) macroexpand ((:doc-group . syntax) |
| 137 | 137 | (:doc-see . macroexpand-1)) caadr ((:doc-group . list)) type-of ((:doc-group . type) (:doc-see . size-of)) top-level-value ((:doc-group . misc) |
| 138 | 138 | (:doc-see . set-top-level-value!)) defstruct ((:doc-group . struct)) caadar ((:doc-group . list)) foldl1 ((:doc-group . list) |
| @@ -237,7 +237,7 @@ group number) "Operations on numbers, mathematical constants." cdaddr "Shorthan · 98 unmodified lines |
| 237 | 237 | (:doc-see . table)) u16 ((:doc-group . number) |
| 238 | 238 | (:doc-see . s16)) logxor ((:doc-group . number)) acos ((:doc-group . number)) time->str ((:doc-group . time) |
| 239 | 239 | (:doc-see . str->time) (:doc-see . time-now)) caddr ((:doc-group . list)) to-proper ((:doc-group . list) |
| 240 | | −(:doc-see . proper-list?)) nestlist ((:doc-group . list)) table-keys ((:doc-group . table) (:doc-see . table-values)) catch ((:doc-group . error) |
| 240 | +(:doc-see . proper-list?)) table-keys ((:doc-group . table) (:doc-see . table-values)) catch ((:doc-group . error) |
| 241 | 241 | (:doc-see . catch) (:doc-see . unwind-protect)) __start ((:doc-group . vm) (:doc-see . __finish)) NIL ((:doc-see . T)) floor ((:doc-group . number) |
| 242 | 242 | (:doc-see . ceiling)) pi ((:doc-group . number)) add-exit-hook ((:doc-group . vm) (:doc-see . *exit-hooks*)) str-join ((:doc-group . string) |
| 243 | 243 | (:doc-see . str-split)) >= ((:doc-group . compare)) lognot ((:doc-group . number)) void? ((:doc-group . type) |
| @@ -543,7 +543,8 @@ io-read-all #fn("n1205021850524228561:" #(#fn(buffer) · 299 unmodified lines |
| 543 | 543 | io-read-line #fn("n12002162:" #(#fn(io-read-until) #\newline) io-read-line 7) |
| 544 | 544 | io-read-lines #fn("n17071062:" #(read-all-of io-read-line) io-read-lines 7) iota |
| 545 | 545 | #fn("|10003000W1000J60E?14W2000J60K?247021182>2062:" #(map-int #fn("n1A0Fi2M:" 7)) iota 7) |
| 546 | | −lambda-vars #fn("n1IIb5b68520_4862186>1_486<00qq544222385>17405162:" #(#fn("n1200513E021220512386K52^161:0:" #(#fn(keyword?) |
| 546 | +iterate #fn("n3E82L2;3B041700015182K~53P:" #(iterate) iterate 10) lambda-vars |
| 547 | +#fn("n1IIb5b68520_4862186>1_486<00qq544222385>17405162:" #(#fn("n1200513E021220512386K52^161:0:" #(#fn(keyword?) |
| 547 | 548 | #fn(sym) #fn(str) #fn(str-sub)) keyword->sym 9) #fn("n40S;J5040R340D:0B3Z00<R3T082;J504833<0702112263:A<0=1828364:0B3\xa500<B3\x9f073051R3Y0740<r252;JF04740<r352;390475051R360q@=070260<2715442873051513=0A<0=182D64:833<0702112963:A<0=1D8364:0B3>0702:0<27164:01C:07021162:702:027164:" #(compile-error |
| 548 | 549 | "invalid argument list " ": optional arguments must come after required" caar length= caddar "invalid optional argument " |
| 549 | 550 | " in list " #fn(keyword?) ": keyword arguments must come last." |
| @@ -601,8 +602,8 @@ max #fn("z113;070210163:0:" #(foldl #fn("n201L23401:0:" 6)) max 8) member · 51 unmodified lines |
| 601 | 602 | #fn("n21<0d3401:13:07001=62:q:" #(member) member 7) memv #fn("n21<0c3401:13:07001=62:q:" #(memv) memv 7) |
| 602 | 603 | min #fn("z113;070210163:0:" #(foldl #fn("n201L23400:1:" 6)) min 8) mod |
| 603 | 604 | #fn("n207001521i2~:" #(div) mod 8) mod0 #fn("n2001k1i2~:" #() mod0 7) negative? |
| 604 | | −#fn("n10EL2:" #() negative? 6) nestlist #fn("n3E82L2;3B041700015182K~53P:" #(nestlist) nestlist 10) |
| 605 | | −newline #fn("|00001000W0000J7070?0421072524I:" #(*io-out* #fn(io-write) *linefeed*) newline 7) |
| 605 | +#fn("n10EL2:" #() negative? 6) newline #fn("|00001000W0000J7070?0421072524I:" #(*io-out* |
| 606 | +#fn(io-write) *linefeed*) newline 7) |
| 606 | 607 | nreconc #fn("n2701062:" #(reverse!-) nreconc 7) nth |
| 607 | 608 | #fn("n2700152<:" #(nthcdr) nth 7) nthcdr #fn("n2701E523400:710=1K~62:" #(<= nthcdr) nthcdr 8) |
| 608 | 609 | num->str #fn("O100010002000W1000J70r:?140X360q@907122052423151360q@907124052475r21rT53360q@907627152423051;J8041r:l2360q@907628152429051S;JK041r:l2;JA047:2;17<1515251360q@90762=15247>7?7@7A7B1w>41w?4qw@4qwA4qwB42C868788898:>52D0>12E8;>1{8;504:" #(#(:base) |