shithub: sl

Download patch

ref: 29c8d9ed10c6dacd49bb039bd7bbde2c47c1d47a
parent: 8fb69dc859d54447081792cdff4c1916a2199110
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon Mar 17 14:15:13 EDT 2025

docstrings: fix signature separation

--- a/boot/sl.boot
+++ b/boot/sl.boot
@@ -12,28 +12,30 @@
               #fn("n201m:" #()) NIL #fn("z0700}2:" #(vec))
               #fn("z0700}2:" #(aset!)) NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL #fn("n3012082>1|:" #(#fn("n1A061:" #())))
               NIL NIL NIL NIL NIL NIL NIL NIL #fn("z0700}2:" #(aref)) NIL NIL NIL)
-            *properties* #table(*funvars* #table(*prompt* (NIL)  lz-unpack ((data :to destination)
-                                                                            (data :size
-                                                                                  decompressed-bytes))  void? ((x))  >= ((a . rest))  defstruct ((name
-  doc options… (slot-1 DEFAULT) slot-2 (slot-3 :read-only))
-  (name (:type vec) (:named T) (:constructor T) (:conc-name NIL) (:predicate NIL) . slots))  help ((term))  length= ((lst
-  n))  __finish ((status))  doc-for ((term (doc NIL)))  rand-u32 (NIL)  = ((a . rest))  rand-u64 (NIL)  car ((lst))  <= ((a . rest))  add-exit-hook ((fun))  /= ((a . rest))  lz-pack ((data
-  (level 0)))  rand (NIL)  nan? ((x))  rand-float (NIL)  void (rest)  cons? ((value))  vm-stats (NIL)  rand-double (NIL)  * ((num…))  cdr ((lst))  + ((num…))  > ((a . rest)))  *doc* #table(>= "Return `T` if the arguments are in non-increasing order (previous\none is greater than or equal to the next one)."  void? "Return `T` if `x` is `#<void>`, `NIL` otherwise."  length= "Perform a bounded length test.\n\nUse this instead of `(= (length lst) n)`, since it avoids unnecessary\nwork and always terminates."  doc-for "Define documentation for a top level term.\n\nIf `term` is a function signature and `doc` is not specified, just\nthe signature will be included in the documentation, without\nreplacing any previously defined."  car "Return the first element of a list or `NIL` if not available."  *builtins* "VM instructions as closures."  <= "Return `T` if the arguments are in non-decreasing order (previous\none is less than or equal to the next one)."  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."  rand "Return a random non-negative fixnum on its maximum range."  nan? "Return `T` if the argument is *NaN*, regardless of the sign."  Instructions "VM instructions mapped to their encoded byte representation."  rand-double "Return a random double on interval [0.0, 1.0]."  > "Return `T` if the arguments are in strictly decreasing order (previous\none is greater than the next one)."  cdr "Return the tail of a list or `NIL` if not available."  + "Return sum of the numbers or `0` with no arguments."  T "A boolean \"true\".\n\n(not T)         → NIL\n(if T 'yes 'no) → 'yes"  lz-unpack "Return decompressed data previously compressed using lz-pack.\n\nEither destination for the decompressed data or the expected size of\nthe decompressed data must be specified.  In the latter case a new\narray is allocated."  __finish "A function called right before exit by the VM."  help "Display documentation for the specified term, if available."  defstruct "Defines a structure type with a specific name and slots.\n\nThe default underlying type is a \"named\" `vector`, where the\nfirst element is the name of the structure's type, the rest are the\nslot values.  If the name as the first element isn't required,\n`:named NIL` should be used.  A `list` can be used instead of a\n`vector` by adding `:type list` option.\n\nThe option `:conc-name` specifies the slot accessor prefix, which\ndefaults to `<name>-`.\n\nDefault predicate name (`<name>?`) can be changed:\n\n    (defstruct blah :predicate blargh? a b c)"  rand-u32 "Return a random integer on interval [0, 2³²-1]."  = "Return `T` if the arguments are equal."  rand-u64 "Return a random integer on interval [0, 2⁶⁴-1]."  NIL "An empty list. Also used as the opposite of T.\n\n(not NIL)         → T\n(if NIL 'yes 'no) → 'no\n(car NIL)         → NIL\n(cdr NIL)         → NIL"  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\nsingle argument, which is (usually) `0` on success and any other\nnumber on error."  /= "Return `T` if not all arguments are equal. Shorthand for `(not (= …))`."  lz-pack "Return data compressed using Lempel-Ziv.\n\nThe data must be an array, returned value will have the same type.\nThe optional `level` is between `0` and `10`.  With `level` set to\n`0` a simple LZSS using hashing will be performed.  Levels between\n`1` and `9` offer a trade-off between time/space and ratio.  Level\n`10` is optimal but very slow."  arg-counts "VM instructions mapped to their expected arguments count."  rand-float "Return a random float on [0.0, 1.0] interval."  *prompt* "Function called by REPL to signal the user input is required.\n\nDefault function prints `#;> `."  cons? "Return `T` if the value is a cons cell."  vm-stats "Print various VM-relat
\ No newline at end of file
+            *properties* #table(*funvars* #table(identity ((x))  >= ((a . rest))  void? ((x))  length= ((lst
+  n))  positive? ((x))  doc-for ((term (doc NIL)))  car ((lst))  <= ((a . rest))  negative? ((x))  rand (NIL)  void (rest)  nan? ((x))  rand-double (NIL)  1- ((n))  cdr ((lst))  + ((num…))  > ((a . rest))  __finish ((status))  lz-unpack ((data
+  :to destination)
+  (data :size decompressed-bytes))  defstruct ((name doc options… (slot-1 DEFAULT) slot-2 (slot-3
+  :read-only))
+                                               (name (:type vec) (:named T) (:constructor T) (:conc-name
+  NIL)
+                                                     (:predicate NIL) . slots))  help ((term))  rand-u32 (NIL)  = ((a . rest))  rand-u64 (NIL)  add-exit-hook ((fun))  /= ((a . rest))  lz-pack ((data
+  (level 0)))  rand-float (NIL)  *prompt* (NIL)  cons? ((value))  vm-stats (NIL)  * ((num…))  1+ ((n))  zero? ((x)))  *doc* #table(zero? "Return `T` if `x` is zero."  >= "Return `T` if the arguments are in non-increasing order (previous\none is greater than or equal to the next one)."  void? "Return `T` if `x` is `#<void>`, `NIL` otherwise."  identity "Return `x`."  length= "Perform a bounded length test.\n\nUse this instead of `(= (length lst) n)`, since it avoids unnecessary\nwork and always terminates."  positive? "Return `T` if `x` is greater than zero."  doc-for "Define documentation for a top level term.\n\nIf `term` is a function signature and `doc` is not specified, just\nthe signature will be included in the documentation, without\nreplacing any previously defined."  car "Return the first element of a list or `NIL` if not available."  *builtins* "VM instructions as closures."  <= "Return `T` if the arguments are in non-decreasing order (previous\none is less than or equal to the next one)."  negative? "Return `T` if `x` is negative."  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."  rand "Return a random non-negative fixnum on its maximum range."  nan? "Return `T` if the argument is *NaN*, regardless of the sign."  Instructions "VM instructions mapped to their encoded byte representation."  rand-double "Return a random double on interval [0.0, 1.0]."  1- "Equivalent to `(- n 1)`."  > "Return `T` if the arguments are in strictly decreasing order (previous\none is greater than the next one)."  cdr "Return the tail of a list or `NIL` if not available."  + "Return sum of the numbers or `0` with no arguments."  T "A boolean \"true\".\n\n(not T)         → NIL\n(if T 'yes 'no) → 'yes"  lz-unpack "Return decompressed data previously compressed using lz-pack.\n\nEither destination for the decompressed data or the expected size of\nthe decompressed data must be specified.  In the latter case a new\narray is allocated."  __finish "A function called right before exit by the VM."  help "Display documentation for the specified term, if available."  defstruct "Defines a structure type with a specific name and slots.\n\nThe default underlying type is a \"named\" `vector`, where the\nfirst element is the name of the structure's type, the rest are the\nslot values.  If the name as the first element isn't required,\n`:named NIL` should be used.  A `list` can be used instead of a\n`vector` by adding `:type list` option.\n\nThe option `:conc-name` specifies the slot accessor prefix, which\ndefaults to `<name>-`.\n\nDefault predicate name (`<name>?`) can be changed:\n\n    (defstruct blah :predicate blargh? a b c)"  rand-u32 "Return a random integer on interval [0, 2³²-1]."  = "Return `T` if the arguments are equal."  rand-u64 "Return a random integer on interval [0, 2⁶⁴-1]."  NIL "An empty list. Also used as the opposite of T.\n\n(not NIL)         → T\n(if NIL 'yes 'no) → 'no\n(car NIL)         → NIL\n(cdr NIL)         → NIL"  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\nsingle argument, which is (usually) `0` on success and any other\nnumber on error."  /= "Return `T` if not all arguments are equal. Shorthand for `(not (= …))`."  lz-pack "Return data compressed using Lempel-Ziv.\n\nThe data must be an array, returned value will have the same type.\nThe optional `level` is between `0` and `10`.  With `level` set to\n`0` a simple LZSS using hashing will be performed.  Levels between\n`1` and `9` offer a trade-off between time/space and ratio.  Level\n`10` is optimal but very slow."  arg-counts "VM instructions mapped to their expected arguments count."  rand-float "Return a random float on [0.0, 1.0] interval."  *prompt* "Function called by REPL to signal the user input is 
\ No newline at end of file
 ed information, such as the number of GC\ncalls so far, heap and stack size, etc."  * "Return product of the numbers or `1` with no arguments."  *properties* "All properties of symbols recorded with `putprop` are recorded in this table."))
             *syntax-environment* #table(bcode:nconst #fn("n1200r2e3:" #(aref))  doc-for #fn("\x8710002000W1000J60q?140B86;35040<;J404086;35040=863H020212287e212288e2e4e2:20212287e21e3e2:" #(void
   sym-set-doc quote))  with-input-from #fn("z12021e1220e2e1e12315163:" #(#fn(nconc) with-bindings
                                                                          *io-in* #fn(copy-list)))  unless #fn("z1200q211Pe4:" #(if
   begin))  defmacro #fn("z170151863D0710<860=5341=?1@30q42223240<e22526e10=e12715153e3e2:" #(value-get-doc
-(if
+63:" #(#fn(nconc) with-bindings
 ax! quote #fn(nconc) λ #fn(copy-list)))  time #fn("n1202122e1e2e123024252622e121e32728e5e3e3:" #(let
   #:g373 time-now prog1 princ "Elapsed time: " - " seconds" *linefeed*))  cond #fn("z0Ib520852185>1_51485<061:" #(#0=#fn("z0I:" #() void)
-e2A<0=51e4e3:2885<2185=PA<0=51e4:" #(else
+340q:0<85<20Q;J80485<DQ3C085=J6085<:2185=P:85=J@02285<A<0=51e3:85T23C\x94074758551513c07675855151278685<e2e12886217975855151PA<0=51e4e3:272:85<e2e1282:7585512:e2A<0=51e4e3:2885<2185=PA<0=51e4:" #(else
 0230522425268827872829e12:1=51522829e12:82512825e18:52e153e4e3e2e12825e18952e3:" #(#fn(map)
   car cadr #fn("n170051B38071061:0<:" #(cddr caddr)) letrec #:g343 λ if #fn(nconc) begin #fn(copy-list)))  mark-label #fn("n22002122e21e4:" #(emit
   quote label))  with-bindings #fn("z12071052207205220230522425e12076888653e12720288687535129242:e12715152242:e127202;8688535152e3e164:" #(#fn(map)
   car cadr #fn("n12060:" #(#fn(gensym))) #fn(nconc) let list #fn(copy-list)
   #fn("n22001e3:" #(set!)) unwind-protect begin #fn("n22001e3:" #(set!))))  let #fn("z1q0R3B00?641<?041=?1@30q42021e12223052e124151532225052863C0268687e2e186e3@408788P:" #(#fn(nconc)
- #fn("n10B3500<:0:" #()) #fn(copy-list)
+tect begin #fn("n22001e3:" #(set!))))  let #fn("z1q0R3B00?641<?041=?1@30q42021e12223052e124151532225052863C0268687e2e186e3@408788P:" #(#fn(nconc)
  #(if begin))  quasiquote #fn("n1700E62:" #(bq-process))  help #fn("n1700215285;3;042285235270024q53863c07586<51486=3Q0262786=52478504873907850@30q@30q@30q4873Q0752951478504262:0>1875247850@30q486;J50487360q@>0752;0524785047<60:" #(getprop
   *doc* #fn(str-split) "\n" *funvars* princ #fn(for-each)
   #fn("n17050471061:" #(newline princ)) newline "Signature:" #fn("n170504712251473A0P61:" #(newline
@@ -49,7 +51,7 @@
 begin def s and or not quote eq? aref = length when
   sym-set-doc #fn(copy-list) map-int #fn("n1A<70F0525170920522193865222872324Ie2e3259423e2e2262724e228232995510Me37:2;85523O02<2=2>2?86e22@2?96e22Ae6e2@B02B232995510M24e4e4e4:" #(list-ref
   #fn(sym) def s v assert if void? aref #fn(length) member :read-only error str "slot " quote " in struct "
-)))  bcode:ctable #fn("n1200Ke3:" #(aref))  with-output-to #fn("z12021e1220e2e1e12315163:" #(#fn(nconc)
+510M24e4e4e4:" #(list-ref
 2722e22829e2e3262:22e20e3e42;22e22<22e2e4e3e3:" #(trycatch
   λ #:g368 if and cons? eq? car quote thrown-value cadr caddr raise))  let* #fn("z10H3E02021e1qe12215153e1:2021e173051e1e1220=B3H02024e10=e12215153e1@301515375051e2:" #(#fn(nconc)
   λ #fn(copy-list) caar let* cadar))  letrec #fn("z1202021e12273052e122240522515154e1227605262:" #(#fn(nconc)
@@ -58,7 +60,7 @@
 200D2122230e2e2e2e4:" #(if raise quote assert-failed))  case #fn("z1Ib6208621_514225023870e2e12425e126278687>215252e3:" #(#0#
   #fn("n2120C5020:1J40q:1R3=021072151e3:1H3=023072151e3:1=J>0230721<51e3:74751523=0260271e2e3:280271e2e3:" #(else
   eq? quote-value eqv? every sym? memq quote memv) vals->cond)
-ensym) let #fn(nconc) cond #fn(map) #fn("n1A<F0<520=P:" #())))  receive #fn("z22021q1e32221e10e123825153e3:" #(call-with-values
+R3=021072151e3:1H3=023072151e3:1=J>0230721<51e3:74751523=0260271e2e3:280271e2e3:" #(else
 53e3:" #(call-with-values
   λ #fn(nconc) #fn(copy-list)))  unwind-protect #fn("n2202122q1e3e2e1232402225e121e12625e2e4e321e1e3e3:" #(let
   #:g369 λ prog1 trycatch #:g370 raise))  dotimes #fn("z10<0T20E2187Ke32223e186e1e12415153e4:" #(for
@@ -434,7 +436,7 @@
 0=51P:" #(to-proper) to-proper)
             top-level-exception-handler #fn("n17071w042285>1230>12486>1{86504:" #(*io-out* *stderr*
                                                                                   #fn("n0Aw0:" #(*io-out*))
-print-exception
+                         #fn("n0Aw0:" #(*io-out*))
 vel-exception-handler)
             trace #fn("n120051718551Jc02207324252627280e225e3e229e12:2885e225e3e55152@30q^147;60:" #(#fn(top-level-value)
   traced? #fn(set-top-level-value!) eval λ #:g371 write cons quote newline apply void) trace)
--- a/src/system.lsp
+++ b/src/system.lsp
@@ -168,6 +168,9 @@
         (when fvs
           (newline))))
     (when fvs
+      (unless (cdr lines)
+        (newline)
+        (newline))
       (princ "Signature:")
       (newline)
       (for-each (λ (fv) (newline) (princ "    ") (print (cons term fv)))
@@ -232,12 +235,15 @@
   `(not (= ,a ,@rest)))
 
 (def (negative? x)
+  "Return `T` if `x` is negative."
   (< x 0))
 
 (def (zero? x)
+  "Return `T` if `x` is zero."
   (= x 0))
 
 (def (positive? x)
+  "Return `T` if `x` is greater than zero."
   (> x 0))
 
 (def (even? x)
@@ -247,12 +253,15 @@
   (not (even? x)))
 
 (def (identity x)
+  "Return `x`."
   x)
 
 (def (1+ n)
+  "Equivalent to `(+ n 1)`."
   (+ n 1))
 
 (def (1- n)
+  "Equivalent to `(- n 1)`."
   (- n 1))
 
 (def (div x y)
@@ -513,9 +522,12 @@
 
 ;;; backquote
 
-(def (revappend l1 l2) (reverse-  l2 l1))
-(def (nreconc   l1 l2) (reverse!- l2 l1))
+(def (revappend l1 l2)
+  (reverse-  l2 l1))
 
+(def (nreconc l1 l2)
+  (reverse!- l2 l1))
+
 (def (self-evaluating? x)
   (and (not (gensym? x))
        (or (and (atom? x)
@@ -619,8 +631,9 @@
                 body))
         ,(cadar binds))))
 
-(defmacro (when   c . body)
+(defmacro (when c . body)
   (list 'if c (cons 'begin body) nil))
+
 (defmacro (unless c . body)
   (list 'if c nil (cons 'begin body)))