shithub: femtolisp

Download patch

ref: 46b1e630115816488566312d1e9b39edbcda1d04
parent: a9b51fb3ace7e855670e737257fd4e15344cd5ca
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Tue Dec 10 12:55:38 EST 2024

rename "separate" → "partition" and get rid of the broken alias from aliases.scm

--- a/aliases.scm
+++ b/aliases.scm
@@ -218,10 +218,6 @@
 
 (define fold-right foldr)
 
-(define (partition pred lst)
-  (let ((s (separate pred lst)))
-    (values (car s) (cdr s))))
-
 (define (dynamic-wind before thunk after)
   (before)
   (unwind-protect (thunk)
--- a/flisp.boot
+++ b/flisp.boot
@@ -340,10 +340,10 @@
 	    newline #fn("8000\x8700001000\x880000I7070?0421072524D:" #(*output-stream*
   #fn(io-write) *linefeed*) newline)
 	    nreconc #fn("7000n2701062:" #(reverse!-) nreconc) odd?
-	    #fn("6000n170051S:" #(even?) odd?) positive? #fn("7000n1700E62:" #(>) positive?)
-	    princ #fn(";000z070Ow042185>1220>12386>1{86504:" #(*print-readably*
-							       #fn("5000n0Aw0:" #(*print-readably*))
-							       #fn("7000n02071A62:" #(#fn(for-each)
+	    #fn("6000n170051S:" #(even?) odd?) partition #fn(":000n2D20?648601qe1qe164:" #(#fn("9000n48283PD1B3Z0401<513?0821<qPN=?2@<0831<qPN=?341=?1@\x05/47088<=88==62:" #(values) partition-)) partition)
+	    positive? #fn("7000n1700E62:" #(>) positive?) princ
+	    #fn(";000z070Ow042185>1220>12386>1{86504:" #(*print-readably* #fn("5000n0Aw0:" #(*print-readably*))
+							 #fn("7000n02071A62:" #(#fn(for-each)
   write)) #fn("6000n1A50420061:" #(#fn(raise)))) princ)
 	    print #fn("9000z02071062:" #(#fn(for-each) write) print)
 	    print-exception #fn("=000n10B3e00<20C^0710r3523T072230T2425760515127554787605151@\x0e00B3Z00<29CS0710r3523I0722:760512;534780T51@\xe100B3P00<2<CI0710r2523?0722=0T2>53@\xbe00B3I00<2?CB0722@514720=f2@\xa200B3N00<2ACG07B76051514722C0T52@\x8107D0513m0710r2523c0780<51472275140T2E8551;I60485R37072@40788551^1@>0722F514780514727G61:" #(type-error
@@ -392,11 +392,10 @@
 	    reverse- #fn("7000n21J400:701<0P1=62:" #(reverse-) reverse-)
 	    self-evaluating? #fn("7000n10H;36040RS;IK0420051;3A040R;3:04021051Q:" #(#fn(constant?)
   #fn(top-level-value)) self-evaluating?)
-	    separate #fn(":000n2D20?648601qe1qe164:" #(#fn("9000n48283PD1B3Z0401<513?0821<qPN=?2@<0831<qPN=?341=?1@\x05/47088<=88==62:" #(values) separate-)) separate)
 	    set-syntax! #fn("8000n220710163:" #(#fn(put!)
 						*syntax-environment*) set-syntax!)
 	    simple-sort #fn("9000n10V;I6040=V3400:0<7021850>22285>162:" #(call-with-values
-  #fn("7000n07021A>1F=62:" #(separate #fn("6000n10AL:" #())))
+  #fn("7000n07021A>1F=62:" #(partition #fn("6000n10AL:" #())))
   #fn("9000n22071051Ae17115163:" #(#fn(nconc) simple-sort))) simple-sort)
 	    splice-form? #fn("7000n10B;3X040<20Q;IN040<21Q;ID040<22Q;3:04730r252;I704022Q:" #(unquote-splicing
   unquote-nsplicing unquote length>) splice-form?)
--- a/system.lsp
+++ b/system.lsp
@@ -245,8 +245,8 @@
                     (set! lst (cdr lst)))))))
   (filter- pred lst (list ())))
 
-(define (separate pred lst)
-  (define (separate- pred lst yes no)
+(define (partition pred lst)
+  (define (partition- pred lst yes no)
     (let ((vals
            (prog1
             (cons yes no)
@@ -258,7 +258,7 @@
                                     (cdr (set-cdr! no  (cons (car lst) ())))))
                           (set! lst (cdr lst)))))))
       (values (cdr (car vals)) (cdr (cdr vals)))))
-  (separate- pred lst (list ()) (list ())))
+  (partition- pred lst (list ()) (list ())))
 
 (define (count f l)
   (define (count- f l n)
@@ -961,7 +961,7 @@
   (if (or (null? l) (null? (cdr l))) l
       (let ((piv (car l)))
         (receive (less grtr)
-                 (separate (λ (x) (< x piv)) (cdr l))
+                 (partition (λ (x) (< x piv)) (cdr l))
                  (nconc (simple-sort less)
                         (list piv)
                         (simple-sort grtr))))))