shithub: sl

Download patch

ref: 00fae165636d2ff516cc114459978fb1855472f9
parent: bf6eea95dd3f2bc659a435c9c04b48b2c41b6c3a
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sun May 18 23:08:07 EDT 2025

simplify "is doc extra?" logic

--- a/boot/sl.boot
+++ b/boot/sl.boot
@@ -235,11 +235,11 @@
 up . prop))  delete-file ((:doc-group . io)
 (:doc-see . file) (:doc-see . path-exists?))  cdddar ((:doc-group . list))  set-cdr! ((:doc-group . list)
 (:doc-group . builtin))  stacktrace ((:doc-group . debug)
-p . builtin))  list->vec ((:doc-group . list)
+p . builtin))  list->vec ((:doc-group . list)
 mber) (:doc-see . even?))  def ((:doc-group . syntax)
 (:doc-see . doc-for)
-debug))  sym ((:doc-group . misc)
-(:doc-see . sym?))  tanh ((:doc-group . number))  for ((:doc-group . syntax) (:doc-see . while))  begin ((:doc-group . syntax)
+debug))  sym ((:doc-group . misc)
+(:doc-see . sym?))  tanh ((:doc-group . number))  for ((:doc-group . syntax) (:doc-see . while))  begin ((:doc-group . syntax)
 rn ((:doc-group . syntax))  *stderr* ((:doc-group . io)
 (:doc-see . *stdout*) (:doc-see . *stdin*))  tan ((:doc-group . number))  table ((:doc-group . table)
 (:doc-see . get)
@@ -247,7 +247,7 @@
 umber))  table ((:doc-group . table)
 (:doc-see . get)
 (:doc-see . put!))  __rcscript ((:doc-group . vm)
-st? ((:doc-group . list)
+st? ((:doc-group . list)
 ) (:doc-see . has?) (:doc-see . get)
 (:doc-see . put!))  when ((:doc-group . syntax)
 (:doc-see . unless) (:doc-see . if))  vec? ((:doc-group . type) (:doc-group . builtin))  min ((:doc-group . compare)
@@ -254,8 +254,7 @@
 o) (:doc-group . type))  eof-object? ((:doc-group . io)
 (:doc-group . type))  help ((:doc-group . doc))  mod ((:doc-group . number) (:doc-see . div) (:doc-see . mod0))  if ((:doc-group . syntax)
 (:doc-see . when) (:doc-see . unless))  p32 ((:doc-group . number) (:doc-see . p64) (:doc-see . ptr))  io-read-lines ((:doc-group . io)
-p . io)
-(:doc-see . io-read-line) (:doc-see . io-read-all))  sym-set-doc ((:doc-group . doc))  macrocall? ((:doc-group . syntax)
+p . io)
 (:doc-see . unwind-protect))  *syntax-environment* ((:doc-group . syntax)
 (:doc-see . get-syntax) (:doc-see . set-syntax!))  table-values ((:doc-group . table) (:doc-see . table-keys))  macroexpand ((:doc-group . syntax)
 (:doc-see . macroexpand-1))  caadr ((:doc-group . list))  top-level-value ((:doc-group . misc) (:doc-see . set-top-level-value!))  defstruct ((:doc-group . struct))  caadar ((:doc-group . list))  buffer ((:doc-group . io))  assoc-list ((:doc-group . list)
@@ -262,7 +261,7 @@
  buffer ((:doc-group . io))  assoc-list ((:doc-group . list)
 (:doc-see . assoc))  builtin? ((:doc-group . type) (:doc-see . builtin) (:doc-see . fn?) (:doc-see . closure?)
 (:doc-group . builtin))  str-map ((:doc-group . string))  macroexpand-1 ((:doc-group . syntax)
-group . string))  negative? ((:doc-group . number) (:doc-group . compare))  void ((:doc-group . misc)
+r ((:doc-group . string))  negative? ((:doc-group . number) (:doc-group . compare))  void ((:doc-group . misc)
 doc-see . assert))  io-read-line ((:doc-group . io)
 (:doc-see . eof-object?) (:doc-see . io-read-lines))  and ((:doc-group . syntax) (:doc-see . or)
 (:doc-see . not))  1- ((:doc-group . number)
@@ -289,7 +288,7 @@
 trace) (:doc-see . traced?))  count ((:doc-group . list))  map-int ((:doc-group . list)
 (:doc-see . iota))  table->assoc-list ((:doc-group . table)
 (:doc-see . table-keys) (:doc-see . table-values))  length< ((:doc-group . list) (:doc-see . length=)
-ntax ((:doc-group . syntax)
+)  get-syntax ((:doc-group . syntax)
 
 (:doc-see . read-all) (:doc-see . io-read-lines))  gc ((:doc-group . vm) (:doc-see . vm-stats))  table-invert ((:doc-group . table)
 (:doc-see . table-values))  lz-unpack ((:doc-group . compress))  div ((:doc-group . number) (:doc-see . mod)
@@ -302,7 +301,7 @@
 group . list) (:doc-group . builtin))  / ((:doc-group . number)
 (:doc-see . div0) (:doc-see . div)
 (:doc-group . builtin))  newline ((:doc-group . io)
-r))  reverse ((:doc-group . list)
+p . number))  reverse ((:doc-group . list)
 rompt* ((:doc-group . vm) (:doc-see . *interactive*))  member ((:doc-group . list)
 (:doc-see . memq) (:doc-see . memv))  bignum? ((:doc-group . type) (:doc-group . number) (:doc-see . bignum))  fixnum ((:doc-group . number)
 (:doc-see . fixnum?))  f64 ((:doc-group . number) (:doc-see . f32))  memq ((:doc-group . list) (:doc-see . member)
@@ -643,9 +642,8 @@
 error #fn("z020210P61:" #(#fn(raise) error) error 7) eval
 #fn("n170710515160:" #(compile-thunk macroexpand) eval 7) even? #fn("n1200K52El2:" #(#fn(logand)) even? 7)
 every #fn("n21S;JD0401<51;3:047001=62:" #(every) every 7) expand-def
- 7)
-every #fn("n21S;JD0401<51;3:047001=62:" #(every) every 7) expand-def
-#fn("n10T70051B3:070051@H085R37021@=07223740515285R3<0258586<e3:2585<2627e185=e178865185<54e3:" #(cddr
+ 7)
+every #fn("n21S;JD0401<51;3:047001=62:" #(every) every 7) expand-def
  #(#fn("n21I0B3P04A0<513>010<qPN=?1@30q40=?0@\x0f/4=:" #() filter- 8)) filter 8)
 find #fn("O200050007000W2000J7071?24W3000J7072?34W4000J60E?44W5000J60q?54W6000J60q?647324830>2125822684278528866::" #(#(:key
 :test :start :end :from-end) identity equal? find-if #fn("n1AF062:" 7) :key :start :end :from-end) find 15)
@@ -691,7 +689,7 @@
 040Te1;JM040TB;3E0471051R;3:0471051e1:0<22C?07324A<0=52}2:q:" #($def
 caadr $begin nconc #fn(map)) #(#1#) 8))) 7)
 get-syntax #fn("n120710q63:" #(#fn(get) *syntax-environment*) get-syntax 8) getprop
-50482:883:02088062:22231e261:" #(#fn(get)
+0q63:" #(#fn(get) *syntax-environment*) get-syntax 8) getprop
 lp-print-header #fn("O200020004000W2000J60q?24W3000J7021?34Ib88822880>2_413C0232483088>3152@c07583514823F0757605151488<2751@>078051488<0514795047960:" #(#(:kind
 :lpad) "" #fn("n1A70_471220RJ:023051@W00R3C00Z3>02324F5151@A07505137026@40272863:" #(void princ
 " ;; [" #fn(type-of)
--- a/src/system.sl
+++ b/src/system.sl
@@ -101,16 +101,12 @@
    contains the rest of the terms."
   :doc-group doc
   (def (doc? kw)
-    (and (> (length kw) 5)
-         (eq? (str-rune kw 1) #\d)
-         (eq? (str-rune kw 2) #\o)
-         (eq? (str-rune kw 3) #\c)
-         (eq? (str-rune kw 4) #\-)))
+    (<= :doc-a kw :doc-z))
   (let {[hd (car body)]
         [tl (cdr body)]}
     (cond [(and (str? hd) (not doc) tl)
            (separate-doc-from-body tl (cons hd doc))]
-          [(and doc (keyword? hd) (doc? (str hd)))
+          [(and doc (doc? hd))
            (separate-doc-from-body (cdr tl) (cons (cons hd (car tl)) doc))]
           [else (cons (reverse doc) body)])))
 
@@ -2592,7 +2588,7 @@
                     constructor))] ; anything else means custom name and args
          ; accessor prefix
          [access (or (and (eq? conc-name T)
-                          (str name "-"))
+                          (sym name "-"))
                      conc-name)]}
     (def (make-constructor args)
       `(λ ,args
--