Changeset 37755 in project


Ignore:
Timestamp:
07/04/19 17:25:20 (13 days ago)
Author:
juergen
Message:

biglists 0.2 with change in syntax of For

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/5/biglists

    r37455 r37755  
    247247==== For
    248248
    249 <macro>(For ((var xs ok-xpr ...) (var1 xs1 ok-xpr1 ...) ...) item-xpr)</macro>
     249<macro>(For item-xpr (var xs ok-xpr ...) (var1 xs1 ok-xpr1 ...) ...)</macro>
    250250
    251251creates a new list by binding var to each element
     
    639639  ;-> '(1 0 3 (1 2 3 4 5))
    640640
    641 (BigList->list (For ((x (List 0 1 2 3)) (add1 x))) ;  map
     641(BigList->list (For (add1 x) (x (List 0 1 2 3)))) ;  map
    642642  ;-> '(1 2 3 4))
    643643
    644 (BigList->list (For ((x (List 0 1 2 3 4 5 6) (odd? x))) x)) ; filter
     644(BigList->list (For x (x (List 0 1 2 3 4 5 6) (odd? x)))) ; filter
    645645  ;-> '(1 3 5))
    646646
    647 (BigList->list (For ((n (List 0 1 2 3 4 5 6) (positive? n) (even? n)))
    648                  (* 10 n)))
     647(BigList->list (For (* 10 n)
     648                    (n (List 0 1 2 3 4 5 6) (positive? n) (even? n))))
    649649  ;-> '(20 40 60))
    650650
    651 (BigList->list (For ((c (List 'A 'B 'C)) ;lazy
    652                      (k '(1 2 3 4))) ;eager
    653                  (list c k)))
     651(BigList->list (For (list c k)
     652                    (c (List 'A 'B 'C)) ;lazy
     653                    (k '(1 2 3 4)))) ;eager
    654654  ;-> '((A 1) (A 2) (A 3) (A 4)
    655655  ;     (B 1) (B 2) (B 3) (B 4)
    656656  ;     (C 1) (C 2) (C 3) (C 4))
    657657
    658 (For ((c '(A B C)) ;eager
    659       (k (List 1 2 3 4))) ;lazy
    660   (list c k))
     658(For (list c k)
     659     (c '(A B C)) ;eager
     660     (k (List 1 2 3 4))) ;lazy
    661661  ;-> '((A 1) (A 2) (A 3) (A 4)
    662662  ;     (B 1) (B 2) (B 3) (B 4)
     
    667667== Last update
    668668
    669 Mar 24, 2019
     669Jul 04, 2019
    670670
    671671== Author
     
    706706== Version History
    707707
     708; 0.2 : syntax of For changed
    708709; 0.1.2 : some typos corrected
    709710; 0.1 : initial import
Note: See TracChangeset for help on using the changeset viewer.