History

sym-set-doc: fix trim-indent

Find the least indented line instead of just using the second one. Also encourage using verbatim strings («») in docstrings.

Sigrid Solveig Haflínudóttir committed 4 months ago

Commit ee261ec1 parent 1c8976d3 files · +54 −59Browse files

Unified · Split

3 files
  1. boot/sl.boot +38 −39
  2. src/docs.sl +6 −6
  3. src/system.sl +10 −14
boot/sl.boot+38−39
@@ -103,7 +103,7 @@ group number) "Operations on numbers, mathematical constants." asin "Return the · 102 unmodified lines
103(:doc-group . sys)) __finish ((:doc-group . vm)103(:doc-group . sys)) __finish ((:doc-group . vm)
104(:doc-see . __start)) caaar ((:doc-group . list)) s32 ((:doc-group . number) (:doc-see . u32)) u8 ((:doc-group . number)104(:doc-see . __start)) caaar ((:doc-group . list)) s32 ((:doc-group . number) (:doc-see . u32)) u8 ((:doc-group . number)
105(:doc-see . s8)) any ((:doc-example . "(any even? '(1 3 5 7)) ; any even number?\n; ↳ NIL")105(:doc-see . s8)) any ((:doc-example . "(any even? '(1 3 5 7)) ; any even number?\n; ↳ NIL")
106(:doc-example . "(any (λ (s) (length> s 1)) ; any string longer than one rune?\n'(\"ab\" \"cd\" \"e\"))\n↳ T")106(:doc-example . "(any (λ (s) (length> s 1)) ; any string longer than one rune?\n '(\"ab\" \"cd\" \"e\"))\n; ↳ T")
107(:doc-group . list) (:doc-see . every)) nthcdr ((:doc-example . "(def l '(a b c))\n(nthcdr l 1)\n; ↳ (b c)\n(nthcdr l 2)\n; ↳ (c)\n(nthcdr l 10)\n; ↳ NIL")107(:doc-group . list) (:doc-see . every)) nthcdr ((:doc-example . "(def l '(a b c))\n(nthcdr l 1)\n; ↳ (b c)\n(nthcdr l 2)\n; ↳ (c)\n(nthcdr l 10)\n; ↳ NIL")
108(:doc-group . list) (:doc-see . nth)) os-getenv ((:doc-group . sys)108(:doc-group . list) (:doc-see . nth)) os-getenv ((:doc-group . sys)
109(:doc-see . os-setenv)) s8 ((:doc-group . number) (:doc-see . u8)) unquote-splicing ((:doc-example . "(def x '(1 2 3))\n`(0 1 ,@(map 1+ x))\n; ↳ (0 1 2 3 4)")109(:doc-see . os-setenv)) s8 ((:doc-group . number) (:doc-see . u8)) unquote-splicing ((:doc-example . "(def x '(1 2 3))\n`(0 1 ,@(map 1+ x))\n; ↳ (0 1 2 3 4)")
@@ -129,12 +129,12 @@ group number) "Operations on numbers, mathematical constants." asin "Return the · 19 unmodified lines
129(:doc-group . builtin)) *random-state* ((:doc-group . random)129(:doc-group . builtin)) *random-state* ((:doc-group . random)
130(:doc-see . make-random-state) (:doc-see . random-state?)) io->str ((:doc-group . io)) bound? ((:doc-example . "(bound? 'bound?)\n; ↳ T")130(:doc-see . make-random-state) (:doc-see . random-state?)) io->str ((:doc-group . io)) bound? ((:doc-example . "(bound? 'bound?)\n; ↳ T")
131(:doc-example . "(bound? 'doesnotcompute)\n; ↳ NIL") (:doc-group . builtin)) list->vec ((:doc-example . "(list->vec '(1 2 a))\n; ↳ #(1 2 a)")131(:doc-example . "(bound? 'doesnotcompute)\n; ↳ NIL") (:doc-group . builtin)) list->vec ((:doc-example . "(list->vec '(1 2 a))\n; ↳ #(1 2 a)")
132(:doc-group . list) (:doc-see . vec->list)) def ((:doc-example . "; a function with documentation (first form)\n(def (f x)\n \"Return the square of doubled `x`.\"\n :doc-example\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")132(:doc-group . list) (:doc-see . vec->list)) def ((:doc-example . "; a function with documentation (first form)\n(def (f x)\n «Return the square of doubled `x`.»\n :doc-example\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")
133(:doc-example . "; a variable (second form)\n(def x (length \"hello\"))\nx\n; ↳ 5")133(:doc-example . "; a variable (second form)\n(def x (length \"hello\"))\nx\n; ↳ 5")
134(:doc-group . syntax) (:doc-see . defdoc) (:doc-see . set!)134(:doc-group . syntax) (:doc-see . defdoc) (:doc-see . set!)
135(:doc-see . let)) call-with-values ((:doc-example . "(call-with-values (λ () (values 1 2 3))\n(λ (a b c) b))\n ; ↳ 2")135(:doc-see . let)) call-with-values ((:doc-example . "(call-with-values (λ () (values 1 2 3))\n (λ (a b c) b))\n; ↳ 2")
136(:doc-example . "(call-with-values (λ () (list 1 2 3))\n(λ (lst) (cadr lst)))\n ; ↳ 2") (:doc-group . syntax)136(:doc-example . "(call-with-values (λ () (list 1 2 3))\n (λ (lst) (cadr lst)))\n; ↳ 2")
137(:doc-see . receive) (:doc-see . values)) odd? ((:doc-group . number) (:doc-see . even?)) list? ((:doc-group . list)137(:doc-group . syntax) (:doc-see . receive) (:doc-see . values)) odd? ((:doc-group . number) (:doc-see . even?)) list? ((:doc-group . list)
138(:doc-group . type) (:doc-see . list) (:doc-see . proper-list?)) str-rep ((:doc-example . "(str-rep \"oi\" 3)\n; ↳ \"oioioi\"")138(:doc-group . type) (:doc-see . list) (:doc-see . proper-list?)) str-rep ((:doc-example . "(str-rep \"oi\" 3)\n; ↳ \"oioioi\"")
139(:doc-example . "(str-rep #\\ы 5)\n; ↳ \"ыыыыы\"")139(:doc-example . "(str-rep #\\ы 5)\n; ↳ \"ыыыыы\"")
140(:doc-example . "(str-rep 'a 3)\n; ↳ \"aaa\"")140(:doc-example . "(str-rep 'a 3)\n; ↳ \"aaa\"")
@@ -146,14 +146,15 @@ group number) "Operations on numbers, mathematical constants." asin "Return the · 5 unmodified lines
146(:doc-group . misc) (:doc-see . type-of)) sym ((:doc-example . "(sym \"a\" 'b 1)\n; ↳ ab1")146(:doc-group . misc) (:doc-see . type-of)) sym ((:doc-example . "(sym \"a\" 'b 1)\n; ↳ ab1")
147(:doc-group . misc)147(:doc-group . misc)
148(:doc-see . sym?)) tanh ((:doc-group . number)) for ((:doc-example . "(for 0 2 (λ (i) (print i)))\n; ‼ 01")148(:doc-see . sym?)) tanh ((:doc-group . number)) for ((:doc-example . "(for 0 2 (λ (i) (print i)))\n; ‼ 01")
149(:doc-group . syntax) (:doc-see . dotimes) (:doc-see . while)) begin ((:doc-example . "(if 1\n(begin (print 1)\n (newline)\n 'ignored\n 'done)\n(print 0)\n(newline)\n'else)\n1\ndone")149(:doc-group . syntax) (:doc-see . dotimes) (:doc-see . while)) begin ((:doc-example . "(if 1\n (begin (print 1)\n (newline)\n 'ignored\n 'done)\n (print 0)\n (newline)\n 'else)\n; ‼ 1\n; ↳ done")
150(:doc-group . syntax) (:doc-see . prog1)) const? ((:doc-example . "(const? 12345) ; a number\n; ↳ T")150(:doc-group . syntax) (:doc-see . prog1)) const? ((:doc-example . "(const? 12345) ; a number\n; ↳ T")
151(:doc-example . "(const? 'const?) ; a function\n; ↳ NIL")151(:doc-example . "(const? 'const?) ; a function\n; ↳ NIL")
152(:doc-example . "(const? 'pi) ; a mathematical constant\n; ↳ T") (:doc-group . type)) str-trim ((:doc-example . "(str-trim \" \\nhello\\t\\v\")\n; ↳ \"hello\"")152(:doc-example . "(const? 'pi) ; a mathematical constant\n; ↳ T") (:doc-group . type)) str-trim ((:doc-example . "(str-trim \" \\nhello\\t\\v\")\n; ↳ \"hello\"")
153(:doc-example . "(str-trim \" \\nhello\\t\\v\"\n(λ (r) (str-find \" \\v\" r)))\nlo\\t\"")153(:doc-example . "(str-trim \" \\nhello\\t\\v\"\n (λ (r) (str-find \" \\v\" r)))\n; ↳ \"\\nhello\\t\"")
154(:doc-example . "(str-trim \"123abc!456def\"\nrune-numeric?\nrune-alphabetic?)\n56\"") (:doc-group . string)154(:doc-example . "(str-trim \"123abc!456def\"\n rune-numeric?\n rune-alphabetic?)\n; ↳ \"abc!456\"")
155(:doc-see . str-sub) (:doc-see . str-map)) io-pos! ((:doc-example . "(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!")155(:doc-group . string) (:doc-see . str-sub) (:doc-see . str-map)) io-pos! ((:doc-example . "(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!")
156(:doc-group . io) (:doc-see . io-pos) (:doc-see . io-skip)) return ((:doc-example . "(def (f x) (when (not x)\n(return 0))\nrinc \"hi\")\newline)\n\n (f 'a)\n ; ‼ hi\n ; ↳ 1\n (f NIL)\n ; ↳ 0")156(:doc-group . io) (:doc-see . io-pos)
157(:doc-see . io-skip)) return ((:doc-example . "(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")
157(:doc-group . syntax)) *stderr* ((:doc-group . io) (:doc-see . *stdout*) (:doc-see . *stdin*)) tan ((:doc-group . number)) table ((:doc-example . "(table)\n; ↳ #table()")158(:doc-group . syntax)) *stderr* ((:doc-group . io) (:doc-see . *stdout*) (:doc-see . *stdin*)) tan ((:doc-group . number)) table ((:doc-example . "(table)\n; ↳ #table()")
158(:doc-example . "(table 'a 1 'b 2)\n; ↳ #table(a 1 b 2)") (:doc-group . table) (:doc-see . get)159(:doc-example . "(table 'a 1 'b 2)\n; ↳ #table(a 1 b 2)") (:doc-group . table) (:doc-see . get)
159(:doc-see . put!)) __rcscript ((:doc-group . vm) (:doc-see . *prompt*) (:doc-see . *interactive*)) doc-group ((:doc-group . doc)) cdaaar ((:doc-group . list)) bounds-error ((:doc-example . "(bounds-error '(1) 1 \"oops\")\n; ‼ out of bounds: oops: index 1 for (1)")160(:doc-see . put!)) __rcscript ((:doc-group . vm) (:doc-see . *prompt*) (:doc-see . *interactive*)) doc-group ((:doc-group . doc)) cdaaar ((:doc-group . list)) bounds-error ((:doc-example . "(bounds-error '(1) 1 \"oops\")\n; ‼ out of bounds: oops: index 1 for (1)")
@@ -173,12 +174,12 @@ group number) "Operations on numbers, mathematical constants." asin "Return the · 13 unmodified lines
173(:doc-example . "(cons 1 '(2))\n; ↳ (1 2)")174(:doc-example . "(cons 1 '(2))\n; ↳ (1 2)")
174(:doc-example . "(cons 1 (cons 2 (cons 3 NIL)))\n; ↳ (1 2 3)") (:doc-group . list)175(:doc-example . "(cons 1 (cons 2 (cons 3 NIL)))\n; ↳ (1 2 3)") (:doc-group . list)
175(:doc-see . cons?) (:doc-see . list) (:doc-group . builtin)) filter ((:doc-example . "(filter odd? '(0 1 2 3 4))\n; ↳ (1 3)")176(:doc-see . cons?) (:doc-see . list) (:doc-group . builtin)) filter ((:doc-example . "(filter odd? '(0 1 2 3 4))\n; ↳ (1 3)")
176(:doc-group . list) (:doc-see . partition)) do ((:doc-example . "(do ((x 0 (+ x 1))) ; x=0 at first, x=x+1 after each step\n((> (sin x) 0.95) ; loop until sin(x) > 0.95\n (newline) ; print a linefeed when loop terminates\n x) ; return final value of x\n(princ x)) ; print x on each step\n‼ 01234567\n↳ 8")177(:doc-group . list) (:doc-see . partition)) do ((:doc-example . "(do ((x 0 (+ x 1))) ; x=0 at first, x=x+1 after each step\n ((> (sin x) 0.95) ; loop until sin(x) > 0.95\n (newline) ; print a linefeed when loop terminates\n x) ; return final value of x\n (princ x)) ; print x on each step\n; ‼ 01234567\n; ↳ 8")
177(:doc-group . syntax) (:doc-see . for) (:doc-see . while)) make-random-state ((:doc-group . random)178(:doc-group . syntax) (:doc-see . for) (:doc-see . while)) make-random-state ((:doc-group . random)
178(:doc-see . *random-state*) (:doc-see . random-state?) (:doc-see . random)) assq ((:doc-group . list)179(:doc-see . *random-state*) (:doc-see . random-state?) (:doc-see . random)) assq ((:doc-group . list)
179(:doc-see . assoc)180(:doc-see . assoc)
180(:doc-see . assv)) let ((:doc-example . "(let ((a 123) (b 456)) ; first form\n(+ a b))\n↳ 579")181(:doc-see . assv)) let ((:doc-example . "(let ((a 123) (b 456)) ; first form\n (+ a b))\n; ↳ 579")
181(:doc-example . "(let loop ((a (iota 3 1))) ; second form\n(when a\n (princ (car a))\n (loop (cdr a))))\n‼ 123\n↳ NIL")182(:doc-example . "(let loop ((a (iota 3 1))) ; second form\n (when a\n (princ (car a))\n (loop (cdr a))))\n; ‼ 123\n; ↳ NIL")
182(:doc-group . syntax) (:doc-see . let*) (:doc-see . letrec)) io-buffer-mode! ((:doc-group . io)183(:doc-group . syntax) (:doc-see . let*) (:doc-see . letrec)) io-buffer-mode! ((:doc-group . io)
183(:doc-see . io-buffer-mode)) del! ((:doc-example . "(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)\nt\n; ↳ #table(a 1)")184(:doc-see . io-buffer-mode)) del! ((:doc-example . "(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)\nt\n; ↳ #table(a 1)")
184(:doc-group . table) (:doc-see . has?) (:doc-see . get) (:doc-see . put!)) when ((:doc-example . "(when (eq? cmd 'exit)\n(princ \"exiting!\")\n(newline)\n(exit))")185(:doc-group . table) (:doc-see . has?) (:doc-see . get) (:doc-see . put!)) when ((:doc-example . "(when (eq? cmd 'exit)\n(princ \"exiting!\")\n(newline)\n(exit))")
@@ -198,9 +199,9 @@ group number) "Operations on numbers, mathematical constants." asin "Return the · 13 unmodified lines
198(:doc-group . number) (:doc-see . div) (:doc-see . mod0)) if ((:doc-example . "(def x '(1))\n(if x (begin (print \"yep!\") (newline) 'yes) 0)\n; ‼ yep!\n; ↳ yes\n(if (str? x) 1 (print \"nope!\") (newline) 'no)\n; ‼ nope!\n; ↳ no")199(:doc-group . number) (:doc-see . div) (:doc-see . mod0)) if ((:doc-example . "(def x '(1))\n(if x (begin (print \"yep!\") (newline) 'yes) 0)\n; ‼ yep!\n; ↳ yes\n(if (str? x) 1 (print \"nope!\") (newline) 'no)\n; ‼ nope!\n; ↳ no")
199(:doc-group . syntax) (:doc-see . when)200(:doc-group . syntax) (:doc-see . when)
200(:doc-see . unless)) p32 ((:doc-group . number)201(:doc-see . unless)) p32 ((:doc-group . number)
201(:doc-see . p64) (:doc-see . ptr)) case ((:doc-example . "(case 'c ; match present\n(a 0)\n((b c d) 1))\n↳ b")202(:doc-see . p64) (:doc-see . ptr)) case ((:doc-example . "(case 'c ; match present\n (a 0)\n ((b c d) 1))\n; ↳ b")
202(:doc-example . "(case (+ 1 2) ; no matches, with else\n(a 0)\n(b 1)\n(else (print 'yay)\n (newline))\n‼ yay")203(:doc-example . "(case (+ 1 2) ; no matches, with else\n (a 0)\n (b 1)\n (else (print 'yay)\n (newline))\n; ‼ yay")
203(:doc-example . "(case \"c\" ; no matches, without else\n(\"a\" 0)\n(\"b\" 1))\n↳ NIL")204(:doc-example . "(case \"c\" ; no matches, without else\n (\"a\" 0)\n (\"b\" 1))\n; ↳ NIL")
204(:doc-group . syntax) (:doc-see . cond)) io-read-lines ((:doc-example . "; 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\")")205(:doc-group . syntax) (:doc-see . cond)) io-read-lines ((:doc-example . "; 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\")")
205(:doc-group . io) (:doc-see . io-read-line) (:doc-see . io-read-all)) io-line ((:doc-group . io)206(:doc-group . io) (:doc-see . io-read-line) (:doc-see . io-read-all)) io-line ((:doc-group . io)
206(:doc-see . io-column)207(:doc-see . io-column)
@@ -213,7 +214,7 @@ group number) "Operations on numbers, mathematical constants." asin "Return the · 6 unmodified lines
213(:doc-example . "(iterate (λ (s) (str-sub s 1)) \"hello\" 5)\n; ↳ (\"hello\" \"ello\" \"llo\" \"lo\" \"o\")")214(:doc-example . "(iterate (λ (s) (str-sub s 1)) \"hello\" 5)\n; ↳ (\"hello\" \"ello\" \"llo\" \"lo\" \"o\")")
214(:doc-group . list)) *syntax-environment* ((:doc-group . syntax) (:doc-see . get-syntax) (:doc-see . set-syntax!)) builtin ((:doc-example . "(builtin 'map)\n; ↳ #fn(map)")215(:doc-group . list)) *syntax-environment* ((:doc-group . syntax) (:doc-see . get-syntax) (:doc-see . set-syntax!)) builtin ((:doc-example . "(builtin 'map)\n; ↳ #fn(map)")
215(:doc-example . "(builtin 'print)\n; ‼ arguments error: builtin \"print\" not found") (:doc-group . vm)) table-values ((:doc-example . "def t #table(a 1 b 2 c 1))\n(table-values t)\n; ↳ (1 2 1)")216(:doc-example . "(builtin 'print)\n; ‼ arguments error: builtin \"print\" not found") (:doc-group . vm)) table-values ((:doc-example . "def t #table(a 1 b 2 c 1))\n(table-values t)\n; ↳ (1 2 1)")
216(:doc-group . table) (:doc-see . table-keys)) macroexpand ((:doc-example . "(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)")217(:doc-group . table) (:doc-see . table-keys)) macroexpand ((:doc-example . "(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)")
217(:doc-group . syntax) (:doc-see . macroexpand-1)) caadr ((:doc-group . list)) type-of ((:doc-example . "(type-of 1)\n; ↳ fixnum")218(:doc-group . syntax) (:doc-see . macroexpand-1)) caadr ((:doc-group . list)) type-of ((:doc-example . "(type-of 1)\n; ↳ fixnum")
218(:doc-example . "(type-of NIL)\n; ↳ null") (:doc-example . "(type-of T)\n; ↳ bool")219(:doc-example . "(type-of NIL)\n; ↳ null") (:doc-example . "(type-of T)\n; ↳ bool")
219(:doc-example . "(type-of \"hello\")\n; ↳ str") (:doc-example . "(type-of (arr 'u32 0 1 2))\n; ↳ (arr u32)")220(:doc-example . "(type-of \"hello\")\n; ↳ str") (:doc-example . "(type-of (arr 'u32 0 1 2))\n; ↳ (arr u32)")
@@ -225,10 +226,10 @@ group number) "Operations on numbers, mathematical constants." asin "Return the · 5 unmodified lines
225(:doc-see . make-random-state)) assoc-list ((:doc-example . "(assoc-list 'a 0 'b 1)\n; ↳ ((a . 0) (b . 1))")226(:doc-see . make-random-state)) assoc-list ((:doc-example . "(assoc-list 'a 0 'b 1)\n; ↳ ((a . 0) (b . 1))")
226(:doc-group . list) (:doc-see . assoc)) builtin? ((:doc-example . "(builtin? map)\n; ↳ T")227(:doc-group . list) (:doc-see . assoc)) builtin? ((:doc-example . "(builtin? map)\n; ↳ T")
227(:doc-example . "(builtin? macroexpand)\n; ↳ NIL") (:doc-group . type) (:doc-see . builtin) (:doc-see . fn?)228(:doc-example . "(builtin? macroexpand)\n; ↳ NIL") (:doc-group . type) (:doc-see . builtin) (:doc-see . fn?)
228(:doc-see . closure?) (:doc-group . builtin)) str-map ((:doc-example . "(str-map rune-upcase\n\"hello, world!\")\nO, WORLD!\"")229(:doc-see . closure?) (:doc-group . builtin)) str-map ((:doc-example . "(str-map rune-upcase\n \"hello, world!\")\n; ↳ \"HELLO, WORLD!\"")
229(:doc-example . "(str-map (λ (r) (str r r))\n\"hello\")\nlllloo\"")230(:doc-example . "(str-map (λ (r) (str r r))\n \"hello\")\n; ↳ \"hheelllloo\"")
230(:doc-example . "(str-map (λ (r) (and (not (rune-whitespace? r)) r))\n\"! this is great !\")\nsisgreat!\"")231(:doc-example . "(str-map (λ (r) (and (not (rune-whitespace? r)) r))\n \"! this is great !\")\n; ↳ \"!thisisgreat!\"")
231(:doc-group . string)) macroexpand-1 ((:doc-example . "(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)")232(:doc-group . string)) macroexpand-1 ((:doc-example . "(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)")
232(:doc-group . syntax) (:doc-see . macroexpand)) +endianness+ ((:doc-group . sys)) remove-duplicates ((:doc-example . "(remove-duplicates '(a 0 b c1 a b 3 c 5))\n; ↳ (a 0 b c1 3 c 5)")233(:doc-group . syntax) (:doc-see . macroexpand)) +endianness+ ((:doc-group . sys)) remove-duplicates ((:doc-example . "(remove-duplicates '(a 0 b c1 a b 3 c 5))\n; ↳ (a 0 b c1 3 c 5)")
233(:doc-group . list)) str ((:doc-example . "(str \"a\" 'b 1 #(0))\n; ↳ \"ab1#(0)\"")234(:doc-group . list)) str ((:doc-example . "(str \"a\" 'b 1 #(0))\n; ↳ \"ab1#(0)\"")
234(:doc-group . string)) negative? ((:doc-group . number) (:doc-group . compare)) void ((:doc-group . misc)235(:doc-group . string)) negative? ((:doc-group . number) (:doc-group . compare)) void ((:doc-group . misc)
@@ -300,7 +301,7 @@ group number) "Operations on numbers, mathematical constants." asin "Return the · 65 unmodified lines
300(:doc-group . time) (:doc-see . nanoseconds-monotonic)) sinh ((:doc-group . number)) *argv* ((:doc-example . "; $ sl -i -H 12345\n*argv*\n; ↳ (\"sl\")")301(:doc-group . time) (:doc-see . nanoseconds-monotonic)) sinh ((:doc-group . number)) *argv* ((:doc-example . "; $ sl -i -H 12345\n*argv*\n; ↳ (\"sl\")")
301(:doc-example . "; $ sl script.sl -i abc\n*argv*\n; ↳ (\"script.sl\" \"-i\" \"abc\")") (:doc-group . vm)302(:doc-example . "; $ sl script.sl -i abc\n*argv*\n; ↳ (\"script.sl\" \"-i\" \"abc\")") (:doc-group . vm)
302(:doc-see . *interactive*)) top-level-exception-handler ((:doc-group . error)) identity ((:doc-group . misc)) untrace ((:doc-example . "(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)")303(:doc-see . *interactive*)) top-level-exception-handler ((:doc-group . error)) identity ((:doc-group . misc)) untrace ((:doc-example . "(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)")
303(:doc-group . debug) (:doc-see . trace) (:doc-see . traced?)) count ((:doc-example . "(count (λ (s) (length> s 1))\n'(\"ab\" \"c\" \"d\" \"ef\"))\n ; ↳ 2")304(:doc-group . debug) (:doc-see . trace) (:doc-see . traced?)) count ((:doc-example . "(count (λ (s) (length> s 1))\n '(\"ab\" \"c\" \"d\" \"ef\"))\n; ↳ 2")
304(:doc-group . list)) io-pos ((:doc-example . "(def f (buffer))\n(io-write f \"hello, world!\")\n(io-pos f)\n; ↳ 13")305(:doc-group . list)) io-pos ((:doc-example . "(def f (buffer))\n(io-write f \"hello, world!\")\n(io-pos f)\n; ↳ 13")
305(:doc-group . io) (:doc-see . io-pos!)) +most-positive-fixnum+ ((:doc-group . number) (:doc-see . +most-negative-fixnum+)) map-int ((:doc-example . "(map-int even? 5)\n; ↳ (T NIL T NIL T)")306(:doc-group . io) (:doc-see . io-pos!)) +most-positive-fixnum+ ((:doc-group . number) (:doc-see . +most-negative-fixnum+)) map-int ((:doc-example . "(map-int even? 5)\n; ↳ (T NIL T NIL T)")
306(:doc-example . "(map-int (λ (i) (str i i i)) 4)\n; ↳ (\"000\" \"111\" \"222\" \"333\")") (:doc-group . list)307(:doc-example . "(map-int (λ (i) (str i i i)) 4)\n; ↳ (\"000\" \"111\" \"222\" \"333\")") (:doc-group . list)
@@ -329,16 +330,16 @@ group number) "Operations on numbers, mathematical constants." asin "Return the · 22 unmodified lines
329(:doc-group . debug) (:doc-see . untrace) (:doc-see . traced?)) io-filename ((:doc-example . "(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\"")330(:doc-group . debug) (:doc-see . untrace) (:doc-see . traced?)) io-filename ((:doc-example . "(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\"")
330(:doc-example . "(io-filename *io-out*)\n; ↳ \"*stdout*\"")331(:doc-example . "(io-filename *io-out*)\n; ↳ \"*stdout*\"")
331(:doc-group . io)332(:doc-group . io)
332(:doc-see . io-filename!)) let* ((:doc-example . "(let* ((a 1)\n(b (+ a 1))\n(c (+ b 1)))\n c)\n ; ↳ 3")333(:doc-see . io-filename!)) let* ((:doc-example . "(let* ((a 1)\n (b (+ a 1))\n (c (+ b 1)))\n c)\n; ↳ 3")
333(:doc-group . syntax) (:doc-see . let) (:doc-see . letrec)) gensym? ((:doc-group . type) (:doc-see . sym?)334(:doc-group . syntax) (:doc-see . let) (:doc-see . letrec)) gensym? ((:doc-group . type) (:doc-see . sym?)
334(:doc-see . sym)) defdoc ((:doc-example . "(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:doc-example\n\"(func 0)\n ; ↳ T\"\n:doc-example\n\"(func 1 3)\n ; ↳ NIL\"\n:doc-group stuff\n:doc-see func2\n:doc-fmt (λ (doc) doc)\nefdoc (func arg (:another-variant NIL)))")335(:doc-see . sym)) defdoc ((:doc-example . "(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 :doc-example\n «(func 0)\n ; ↳ T»\n :doc-example\n «(func 1 3)\n ; ↳ NIL»\n :doc-group stuff\n :doc-see func2\n :doc-fmt (λ (doc) doc)\n(defdoc (func arg (:another-variant NIL)))")
335(:doc-group . doc)) cdddr ((:doc-group . list)) copy-table ((:doc-example . "(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")336(:doc-group . doc)) cdddr ((:doc-group . list)) copy-table ((:doc-example . "(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")
336(:doc-group . table) (:doc-see . table->assoc-list)) set-car! ((:doc-example . "(def q '(1 2 3 4 5))\n(set-car! q 0)\n; ↳ (0 6 7)\nq\n; ↳ (0 6 7)")337(:doc-group . table) (:doc-see . table->assoc-list)) set-car! ((:doc-example . "(def q '(1 2 3 4 5))\n(set-car! q 0)\n; ↳ (0 6 7)\nq\n; ↳ (0 6 7)")
337(:doc-group . list) (:doc-group . builtin)) receive ((:doc-example . "(receive (a b c) (values 1 2 3) b)\n; ↳ 2")338(:doc-group . list) (:doc-group . builtin)) receive ((:doc-example . "(receive (a b c) (values 1 2 3) b)\n; ↳ 2")
338(:doc-example . "(receive (odd even) (partition odd? '(0 1 2 3 4 5))\n(map cons odd even))\n↳ ((1 . 0) (3 . 2) (5 . 4))")339(:doc-example . "(receive (odd even) (partition odd? '(0 1 2 3 4 5))\n (map cons odd even))\n; ↳ ((1 . 0) (3 . 2) (5 . 4))")
339(:doc-example . "(receive (lst) '(1 2 3) (cadr lst))\n; ↳ 2") (:doc-group . syntax) (:doc-see . values)340(:doc-example . "(receive (lst) '(1 2 3) (cadr lst))\n; ↳ 2") (:doc-group . syntax) (:doc-see . values)
340(:doc-see . call-with-values)) partition ((:doc-example . "; 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)")341(:doc-see . call-with-values)) partition ((:doc-example . "; 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)")
341(:doc-group . list) (:doc-see . filter) (:doc-see . receive)) dotimes ((:doc-example . "(dotimes (x 3 \"heh\")\n(print x)\n(newline))\n‼ 0\n‼ 1\n‼ 2\n↳ \"heh\"")342(:doc-group . list) (:doc-see . filter) (:doc-see . receive)) dotimes ((:doc-example . "(dotimes (x 3 \"heh\")\n (print x)\n (newline))\n; ‼ 0\n; ‼ 1\n; ‼ 2\n; ↳ \"heh\"")
342(:doc-group . syntax) (:doc-see . for) (:doc-see . while)) has? ((:doc-example . "(def t #table(a 1 b 2))\n(has? t 'c)\n; ↳ NIL\n(has? t 'a)\n; ↳ T")343(:doc-group . syntax) (:doc-see . for) (:doc-see . while)) has? ((:doc-example . "(def t #table(a 1 b 2))\n(has? t 'c)\n; ↳ NIL\n(has? t 'a)\n; ↳ T")
343(:doc-group . table) (:doc-see . get)344(:doc-group . table) (:doc-see . get)
344(:doc-see . put!) (:doc-see . del!)) vec ((:doc-example . "(vec) ; empty vector\n; ↳ #()")345(:doc-see . put!) (:doc-see . del!)) vec ((:doc-example . "(vec) ; empty vector\n; ↳ #()")
@@ -397,12 +398,12 @@ group number) "Operations on numbers, mathematical constants." asin "Return the · 52 unmodified lines
397(:doc-group . error)) *io-err* ((:doc-group . io)398(:doc-group . error)) *io-err* ((:doc-group . io)
398(:doc-see . *io-out*) (:doc-see . *io-in*) (:doc-see . with-bindings)) print-exception ((:doc-example . "(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")399(:doc-see . *io-out*) (:doc-see . *io-in*) (:doc-see . with-bindings)) print-exception ((:doc-example . "(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")
399(:doc-group . error) (:doc-see . *exception-print-level*)400(:doc-group . error) (:doc-see . *exception-print-level*)
400(:doc-see . *exception-print-length*)) set-top-level-value! ((:doc-example . "(let {[abc 2]}\n(set-top-level-value! 'abc 123)\nabc)\n↳ 2\nc\n↳ 123")401(:doc-see . *exception-print-length*)) set-top-level-value! ((:doc-example . "(let {[abc 2]}\n (set-top-level-value! 'abc 123)\n abc)\n; ↳ 2\nabc\n; ↳ 123")
401(:doc-group . misc) (:doc-see . top-level-value)402(:doc-group . misc) (:doc-see . top-level-value)
402(:doc-see . set!)) load ((:doc-example . "(load \"stuff.sl\")")403(:doc-see . set!)) load ((:doc-example . "(load \"stuff.sl\")")
403(:doc-group . vm) (:doc-see . eval)) getpid ((:doc-group . sys)) keyword? ((:doc-group . type)) aref ((:doc-example . "(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")404(:doc-group . vm) (:doc-see . eval)) getpid ((:doc-group . sys)) keyword? ((:doc-group . type)) aref ((:doc-example . "(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")
404(:doc-group . array) (:doc-see . aset!) (:doc-group . builtin)) sym? ((:doc-group . type) (:doc-see . sym)405(:doc-group . array) (:doc-see . aset!) (:doc-group . builtin)) sym? ((:doc-group . type) (:doc-see . sym)
405(:doc-see . gensym?) (:doc-group . builtin)) defmacro ((:doc-example . "(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))))\nnc! 1)\n↳ 2\net! x 1)\nnc! x)\n↳ 2\n x\n↳ 2")406(:doc-see . gensym?) (:doc-group . builtin)) defmacro ((:doc-example . "(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\nx\n; ↳ 2")
406(:doc-group . syntax) (:doc-see . macroexpand)) u64 ((:doc-group . number)407(:doc-group . syntax) (:doc-see . macroexpand)) u64 ((:doc-group . number)
407(:doc-see . s64)) int-valued? ((:doc-example . "(int-valued? -123.0)\n; ↳ T")408(:doc-see . s64)) int-valued? ((:doc-example . "(int-valued? -123.0)\n; ↳ T")
408(:doc-example . "(int-valued? -123.1)\n; ↳ NIL") (:doc-group . number)409(:doc-example . "(int-valued? -123.1)\n; ↳ NIL") (:doc-group . number)
@@ -420,7 +421,7 @@ group number) "Operations on numbers, mathematical constants." asin "Return the · 11 unmodified lines
420(:doc-see . unquote)) nreconc ((:doc-example . "(def a '(4 5 6))\n(nreconc a '(3 2 1))\n; ↳ (6 5 4 3 2 1)")421(:doc-see . unquote)) nreconc ((:doc-example . "(def a '(4 5 6))\n(nreconc a '(3 2 1))\n; ↳ (6 5 4 3 2 1)")
421(:doc-group . list)422(:doc-group . list)
422(:doc-see . revappend)) defc*r ((:doc-example . "(defc*r caaaaaaaaddr)\n(caaaaaaaaddr '(0 1 (((((((2 3 4)))))))))\n; ↳ 2")423(:doc-see . revappend)) defc*r ((:doc-example . "(defc*r caaaaaaaaddr)\n(caaaaaaaaddr '(0 1 (((((((2 3 4)))))))))\n; ↳ 2")
423(:doc-group . list)) read-all-of ((:doc-group . io) (:doc-see . read-all) (:doc-see . io-read-lines)) cddddr ((:doc-group . list)) prog1 ((:doc-example . "(prog1 (+ 1 2 3)\n(print \"hi\")\n(newline))\n ; ↳ 6")424(:doc-group . list)) read-all-of ((:doc-group . io) (:doc-see . read-all) (:doc-see . io-read-lines)) cddddr ((:doc-group . list)) prog1 ((:doc-example . "(prog1 (+ 1 2 3)\n (print \"hi\")\n (newline))\n; ↳ 6")
424(:doc-group . syntax) (:doc-see . begin)) logior ((:doc-example . "(logior)\n; ↳ 0") (:doc-example . "(logior 2)\n; ↳ 2")425(:doc-group . syntax) (:doc-see . begin)) logior ((:doc-example . "(logior)\n; ↳ 0") (:doc-example . "(logior 2)\n; ↳ 2")
425(:doc-example . "(logior 2 3)\n; ↳ 3")426(:doc-example . "(logior 2 3)\n; ↳ 3")
426(:doc-example . "(logior 2 3 4)\n; ↳ 7")427(:doc-example . "(logior 2 3 4)\n; ↳ 7")
@@ -437,13 +438,13 @@ group number) "Operations on numbers, mathematical constants." asin "Return the · 10 unmodified lines
437(:doc-see . path-exists?)) *print-width* ((:doc-example . "(with-bindings ((*print-width* 3)) (princ \"abcde\"))\n; ‼ abc...")438(:doc-see . path-exists?)) *print-width* ((:doc-example . "(with-bindings ((*print-width* 3)) (princ \"abcde\"))\n; ‼ abc...")
438(:doc-example . "(with-bindings ((*print-width* 3)) (princ \"ab𲎿\"))\n; ‼ ab...")439(:doc-example . "(with-bindings ((*print-width* 3)) (princ \"ab𲎿\"))\n; ‼ ab...")
439(:doc-group . io) (:doc-see . princ)) arr? ((:doc-group . type)440(:doc-group . io) (:doc-see . princ)) arr? ((:doc-group . type)
440(:doc-see . vec?) (:doc-see . arr) (:doc-see . vec)) cadaar ((:doc-group . list)) unwind-protect ((:doc-example . "(unwind-protect (begin (print \"a\") (newline)\n(print (/ 1 0)) (newline) ; an error here\n(print \"b\") (newline)\n(print \"c\") (newline))))\n ; ↳ \"a\"\n ; ↳ \"c\"\n")441(:doc-see . vec?) (:doc-see . arr) (:doc-see . vec)) cadaar ((:doc-group . list)) unwind-protect ((:doc-example . "(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")
441(:doc-group . error) (:doc-see . catch)) cos ((:doc-group . number)) io-skip ((:doc-example . "(def f (buffer))\n(io-write f \"hello, world!\")\n(io-skip f -6 :end T)\n; ↳ 7\n(read f)\n; ↳ world!")442(:doc-group . error) (:doc-see . catch)) cos ((:doc-group . number)) io-skip ((:doc-example . "(def f (buffer))\n(io-write f \"hello, world!\")\n(io-skip f -6 :end T)\n; ↳ 7\n(read f)\n; ↳ world!")
442(:doc-group . io)443(:doc-group . io)
443(:doc-see . io-pos!)) *io-in* ((:doc-group . io)444(:doc-see . io-pos!)) *io-in* ((:doc-group . io)
444(:doc-see . *io-out*) (:doc-see . *io-err*) (:doc-see . with-input-from)) with-bindings ((:doc-example . "(def (s) (str *print-base* #\\. *print-radix* #\\. 123))\n(s)\n; ↳ \"10.NIL.123\"\n(with-bindings ((*print-base* 16)\n (*print-radix* T))\n (s))\n; ↳ \"#x10.T.#x7B\"\n(s)\n; ↳ \"10.NIL.123\"")445(:doc-see . *io-out*) (:doc-see . *io-err*) (:doc-see . with-input-from)) with-bindings ((:doc-example . "(def (s) (str *print-base* #\\. *print-radix* #\\. 123))\n(s)\n; ↳ \"10.NIL.123\"\n(with-bindings ((*print-base* 16)\n (*print-radix* T))\n (s))\n; ↳ \"#x10.T.#x7B\"\n(s)\n; ↳ \"10.NIL.123\"")
445(:doc-group . syntax) (:doc-see . def) (:doc-see . let) (:doc-see . set!)) every ((:doc-example . "(every odd? '(1 3 5 7)) ; every number odd?\n; ↳ T")446(:doc-group . syntax) (:doc-see . def) (:doc-see . let) (:doc-see . set!)) every ((:doc-example . "(every odd? '(1 3 5 7)) ; every number odd?\n; ↳ T")
446(:doc-example . "(every (λ (s) (length> s 1)) ; every string longer than one rune?\n'(\"ab\" \"cd\" \"e\"))\n↳ NIL")447(:doc-example . "(every (λ (s) (length> s 1)) ; every string longer than one rune?\n '(\"ab\" \"cd\" \"e\"))\n; ↳ NIL")
447(:doc-group . list)448(:doc-group . list)
448(:doc-see . any)) atom? ((:doc-example . "(atom? \"a\")\n; ↳ T")449(:doc-see . any)) atom? ((:doc-example . "(atom? \"a\")\n; ↳ T")
449(:doc-example . "(atom? NIL)\n; ↳ T") (:doc-example . "(atom? '(1))\n; ↳ NIL") (:doc-group . type)450(:doc-example . "(atom? NIL)\n; ↳ T") (:doc-example . "(atom? '(1))\n; ↳ NIL") (:doc-group . type)
@@ -452,7 +453,7 @@ group number) "Operations on numbers, mathematical constants." asin "Return the · 2 unmodified lines
452(:doc-example . "(apply vec '(1 2 3))\n; ↳ #(3 4 5)")453(:doc-example . "(apply vec '(1 2 3))\n; ↳ #(3 4 5)")
453(:doc-example . "(apply arr 'u8 '(3 4 5))\n; ↳ #vu8(3 4 5)") (:doc-group . builtin)) cddr ((:doc-group . list)) not ((:doc-group . syntax)454(:doc-example . "(apply arr 'u8 '(3 4 5))\n; ↳ #vu8(3 4 5)") (:doc-group . builtin)) cddr ((:doc-group . list)) not ((:doc-group . syntax)
454(:doc-see . and) (:doc-see . or) (:doc-group . builtin)) print ((:doc-example . "(print 1 2 \"abc\")\n; ‼ 1 2 \"abc\"")455(:doc-see . and) (:doc-see . or) (:doc-group . builtin)) print ((:doc-example . "(print 1 2 \"abc\")\n; ‼ 1 2 \"abc\"")
455(:doc-group . io) (:doc-see . princ)) letrec ((:doc-example . "(letrec ((a (λ () 1))\n(b (λ () (+ (c) 1)))\n(c (λ () (+ (a) 1))))\na) (b) (c)))\n2)")456(:doc-group . io) (:doc-see . princ)) letrec ((:doc-example . "(letrec ((a (λ () 1))\n (b (λ () (+ (c) 1)))\n (c (λ () (+ (a) 1))))\n (list (a) (b) (c)))\n; ↳ (1 3 2)")
456(:doc-group . syntax) (:doc-see . let) (:doc-see . let*)) cdar ((:doc-group . list)) cdaar ((:doc-group . list)) iota ((:doc-example . "(iota 4)\n; ↳ (0 1 2 3)")457(:doc-group . syntax) (:doc-see . let) (:doc-see . let*)) cdar ((:doc-group . list)) cdaar ((:doc-group . list)) iota ((:doc-example . "(iota 4)\n; ↳ (0 1 2 3)")
457(:doc-example . "(iota 4 6)\n; ↳ (6 7 8 9)") (:doc-example . "(iota 4 6 -0.5)\n; ↳ (6 5.5 5.0 4.5)")458(:doc-example . "(iota 4 6)\n; ↳ (6 7 8 9)") (:doc-example . "(iota 4 6 -0.5)\n; ↳ (6 5.5 5.0 4.5)")
458(:doc-group . list) (:doc-see . map-int)) caaddr ((:doc-group . list)) environment ((:doc-group . debug)459(:doc-group . list) (:doc-see . map-int)) caaddr ((:doc-group . list)) environment ((:doc-group . debug)
@@ -485,7 +486,7 @@ group number) "Operations on numbers, mathematical constants." asin "Return the · 26 unmodified lines
485(:doc-example . "(cdr NIL)\n; ↳ NIL")486(:doc-example . "(cdr NIL)\n; ↳ NIL")
486(:doc-see . T)) floor ((:doc-example . "(floor 1.2)\n; ↳ 1.0")487(:doc-see . T)) floor ((:doc-example . "(floor 1.2)\n; ↳ 1.0")
487(:doc-example . "(floor -1.2)\n; ↳ -2.0") (:doc-example . "(floor -5)\n; ↳ -5.0") (:doc-group . number)488(:doc-example . "(floor -1.2)\n; ↳ -2.0") (:doc-example . "(floor -5)\n; ↳ -5.0") (:doc-group . number)
488(:doc-see . ceiling)) add-exit-hook ((:doc-group . vm) (:doc-see . *exit-hooks*)) str-join ((:doc-example . "(str-join '(\"\" \"n\" \"9\" \"heh\")\n*directory-separator*)\nheh\"")489(:doc-see . ceiling)) add-exit-hook ((:doc-group . vm) (:doc-see . *exit-hooks*)) str-join ((:doc-example . "(str-join '(\"\" \"n\" \"9\" \"heh\")\n *directory-separator*)\n; ↳ \"/n/9/heh\"")
489(:doc-example . "(str-join '(\"a\" \"b\" \"c\") #\\.)\n; ↳ \"a.b.c\"") (:doc-group . string) (:doc-see . str-split)) >= ((:doc-group . compare)) +f32-epsilon+ ((:doc-group . number)490(:doc-example . "(str-join '(\"a\" \"b\" \"c\") #\\.)\n; ↳ \"a.b.c\"") (:doc-group . string) (:doc-see . str-split)) >= ((:doc-group . compare)) +f32-epsilon+ ((:doc-group . number)
490(:doc-see . +f64-epsilon)) lognot ((:doc-example . "(lognot 0)\n; ↳ -1") (:doc-example . "(lognot #s8(63))\n; ↳ #s8(-64)")491(:doc-see . +f64-epsilon)) lognot ((:doc-example . "(lognot 0)\n; ↳ -1") (:doc-example . "(lognot #s8(63))\n; ↳ #s8(-64)")
491(:doc-example . "(lognot #u16(32767))\n; ↳ #u16(32768)")492(:doc-example . "(lognot #u16(32767))\n; ↳ #u16(32768)")
@@ -999,12 +1000,10 @@ length< bounds-error 1-) subseq-l 10) #fn("n120A51F;J504858586L23<071A8652@:0086 · 507 unmodified lines
999bounds-error #1#) subseq-av 15) vec-alloc #fn(str?)1000bounds-error #1#) subseq-av 15) vec-alloc #fn(str?)
1000#fn(str-sub) arr? #fn(type-of) #fn("n120A0E63:" #(#fn(arr-alloc)) 8)) subseq 11)1001#fn(str-sub) arr? #fn(type-of) #fn("n120A0E63:" #(#fn(arr-alloc)) 8)) subseq 11)
1001sym-set-doc #fn("z2IIIb7b8872087>1_48821_42288>1?94231518:3601@401<8:360q@:024891=522487<82528;3V07502688<8;515348<3>0750278<53@30q@30q48=B3N075028797:7;028q538=525153@30q4I:" #(#fn("n10H3700:@30q40<85B3I07085r2523>07185Er253@4085A<0=51P:" #(length>1002sym-set-doc #fn("z2IIIb7b8872087>1_48821_42288>1?94231518:3601@401<8:360q@:024891=522487<82528;3V07502688<8;515348<3>0750278<53@30q@30q48=B3N075028797:7;028q538=525153@30q4I:" #(#fn("n10H3700:@30q40<85B3I07085r2523>07185Er253@4085A<0=51P:" #(length>
1002subseq) formals-clean 9) #fn("n120Z3<021Z360q@400:4220235285<85=7425875288;3D042688512670885151~88;3?04272889>1875271868:P2362:" #(str-trim1003subseq) formals-clean 9) #fn("n120Z3<021Z360q@400:4220235285<85=87;3?047425268752f287;3?04252788>18752718689P2362:" #(str-trim
1003str-join #fn(str-split) "\n" any #fn("n1E20051L2;3C0421220E5251;34040:" #(#fn(length)1004str-join #fn(str-split) "\n" min #fn(map) #fn("n1E20051L2;3B0420051207105151~:" #(#fn(length)
1004#fn(rune-whitespace?)1005str-trim) 8)
1005#fn(str-rune)) 8)1006#fn("n170A2105152390220A62:0:" #(<= #fn(length) #fn(str-sub)) 8)) trim-indent 12)
1006#fn(length) #fn(map) #fn("n170A2105152390220A62:0:" #(<= #fn(length)
1007#fn(str-sub)) 8)) trim-indent 13)
1008#fn("n10B3?0200=51360q@400:40A<0=51N:" #(#fn(str?)) extra-clean 7)1007#fn("n10B3?0200=51360q@400:40A<0=51N:" #(#fn(str?)) extra-clean 7)
1009#fn(str?) #fn(map) putprop *doc* *doc-extra* *formals-list* remove-duplicates append getprop) sym-set-doc 20)1008#fn(str?) #fn(map) putprop *doc* *doc-extra* *formals-list* remove-duplicates append getprop) sym-set-doc 20)
1010t0_auto39# #:t0_auto39# t0_auto51# #:t0_auto51# table->assoc-list1009t0_auto39# #:t0_auto39# t0_auto51# #:t0_auto51# table->assoc-list
src/docs.sl+6−6
@@ -19,16 +19,16 @@ · 18 unmodified lines
19 by `defstruct` to provide full constructor description in the output.»19 by `defstruct` to provide full constructor description in the output.»
20 :doc-example20 :doc-example
21 «(defdoc (func arg (arg2 0))21 «(defdoc (func arg (arg2 0))
22 "Return something about the `arg` and `arg2`. This is a short22 «Return something about the `arg` and `arg2`. This is a short
23 description.23 description.
24 24
25 This is the longer description, following the short one."25 This is the longer description, following the short one.\»
26 :doc-example26 :doc-example
27 "(func 0)27 «(func 0)
28 ; ↳ T"28 ; ↳ T\»
29 :doc-example29 :doc-example
30 "(func 1 3)30 «(func 1 3)
31 ; ↳ NIL"31 ; ↳ NIL\»
32 :doc-group stuff32 :doc-group stuff
33 :doc-see func233 :doc-see func2
34 :doc-fmt (λ (doc) doc)34 :doc-fmt (λ (doc) doc)
src/system.sl+10−14
@@ -169,14 +169,10 @@ · 168 unmodified lines
169 (let* {[lines (str-split s "\n")]169 (let* {[lines (str-split s "\n")]
170 [hd (car lines)]170 [hd (car lines)]
171 [tl (cdr lines)]171 [tl (cdr lines)]
172 [snd (any (λ (s) (and (> (length s) 0)172 [indent (and tl (apply min (map (λ (s) (and (> (length s) 0)
173 (rune-whitespace? (str-rune s 0))173 (- (length s) (length (str-trim s)))))
174 s))174 tl)))]
175 tl)]175 [trimmed (and tl
176 [indent (and snd
177 (- (length snd)
178 (length (str-trim snd))))]
179 [trimmed (and snd
180 (map (λ (s) (if (<= indent (length s))176 (map (λ (s) (if (<= indent (length s))
181 (str-sub s indent)177 (str-sub s indent)
182 s))178 s))
@@ -1658,7 +1654,7 @@ · 1475 unmodified lines
1658 «Define a new macro.»1654 «Define a new macro.»
1659 :doc-example1655 :doc-example
1660 «(defmacro (inc! v)1656 «(defmacro (inc! v)
1661 "Increments and returns the value."1657 «Increments and returns the value.\»
1662 :doc-group my-cool-macros1658 :doc-group my-cool-macros
1663 :doc-see my-other-cool-macro1659 :doc-see my-other-cool-macro
1664 (if (num? v)1660 (if (num? v)
@@ -1749,10 +1745,10 @@ · 84 unmodified lines
1749 :doc-example1745 :doc-example
1750 «; a function with documentation (first form)1746 «; a function with documentation (first form)
1751 (def (f x)1747 (def (f x)
1752 "Return the square of doubled `x`."1748 «Return the square of doubled `x`.\»
1753 :doc-example1749 :doc-example
1754 "(f 3)1750 «(f 3)
1755 ; ↳ 36"1751 ; ↳ 36\»
1756 :doc-group cool-funcs ; documentation group for (help groups)1752 :doc-group cool-funcs ; documentation group for (help groups)
1757 :doc-see g ; reference another function in the documentation1753 :doc-see g ; reference another function in the documentation
1758 (def (g y) ; an internal function1754 (def (g y) ; an internal function
@@ -2110,7 +2106,7 @@ · 351 unmodified lines
2110 If no `else` was specified and no matches occured, `NIL` is2106 If no `else` was specified and no matches occured, `NIL` is
2111 returned.»2107 returned.»
2112 :doc-example2108 :doc-example
2113 «(case 'c ; match present2109 «(case 'c ; match present
2114 (a 0)2110 (a 0)
2115 ((b c d) 1))2111 ((b c d) 1))
2116 ; ↳ b»2112 ; ↳ b»
@@ -2122,7 +2118,7 @@ · 5 unmodified lines
2122 (newline))2118 (newline))
2123 ; ‼ yay»2119 ; ‼ yay»
2124 :doc-example2120 :doc-example
2125 «(case "c" ; no matches, without else2121 «(case "c" ; no matches, without else
2126 ("a" 0)2122 ("a" 0)
2127 ("b" 1))2123 ("b" 1))
2128 ; ↳ NIL»2124 ; ↳ NIL»

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