Changeset 33584 in project


Ignore:
Timestamp:
08/12/16 17:03:38 (4 years ago)
Author:
Jeremy Steward
Message:

Replaces λ with lambda in examples

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/srfi-133

    r33577 r33584  
    6565
    6666<enscript highlight="scheme">
    67 (vector-unfold (λ (i x) (values x (- x 1)))
     67(vector-unfold (lambda (i x) (values x (- x 1)))
    6868                 10 0)
    6969 ;=> #(0 -1 -2 -3 -4 -5 -6 -7 -8 -9)
     
    8080
    8181<enscript highlight="scheme">
    82 (vector-unfold (λ (i) (vector-ref vector i))
     82(vector-unfold (lambda (i) (vector-ref vector i))
    8383                 (vector-length vector))
    8484</enscript>
     
    9696
    9797<enscript highlight="scheme">
    98 (vector-unfold-right (λ (i x) (values (cons i x) (+ x 1))) 5 0)
     98(vector-unfold-right (lambda (i x) (values (cons i x) (+ x 1))) 5 0)
    9999 ;=> #((0 . 4) (1 . 3) (2 . 2) (3 . 1) (4 . 0))
    100100</enscript>
     
    103103
    104104<enscript highlight="scheme">
    105 (vector-unfold-right (λ (i x) (values (vector-ref vector x) (+ x 1)))
     105(vector-unfold-right (lambda (i x) (values (vector-ref vector x) (+ x 1)))
    106106                       (vector-length vector)
    107107                       0)
     
    304304Find the longest string's length in vector-of-strings.
    305305<enscript highlight="scheme">
    306 (vector-fold (λ (len str) (max (string-length str) len))
     306(vector-fold (lambda (len str) (max (string-length str) len))
    307307               0 vector-of-strings)
    308308</enscript>
     
    310310Produce a list of the reversed elements of vec.
    311311<enscript highlight="scheme">
    312 (vector-fold (λ (tail elt) (cons elt tail))
     312(vector-fold (lambda (tail elt) (cons elt tail))
    313313               '() vec)
    314314</enscript>
     
    316316Count the number of even numbers in vec.
    317317<enscript highlight="scheme">
    318 (vector-fold (λ (counter n)
     318(vector-fold (lambda (counter n)
    319319                 (if (even? n) (+ counter 1) counter))
    320320               0 vec)
     
    330330Convert a vector to a list.
    331331<enscript highlight="scheme">
    332 (vector-fold-right (λ (tail elt) (cons elt tail))
     332(vector-fold-right (lambda (tail elt) (cons elt tail))
    333333                     '() '#(a b c d))
    334334 ;=> (a b c d)
     
    345345
    346346<enscript highlight="scheme">
    347 (vector-map (λ (x) (* x x))
    348               (vector-unfold (λ (i x) (values x (+ x 1))) 4 1))
     347(vector-map (lambda (x) (* x x))
     348              (vector-unfold (lambda (i x) (values x (+ x 1))) 4 1))
    349349 ;=> #(1 4 9 16)
    350350
    351 (vector-map (λ (x y) (* x y))
    352               (vector-unfold (λ (x) (values x (+ x 1))) 5 1)
    353               (vector-unfold (λ (x) (values x (- x 1))) 5 5))
     351(vector-map (lambda (x y) (* x y))
     352              (vector-unfold (lambda (x) (values x (+ x 1))) 5 1)
     353              (vector-unfold (lambda (x) (values x (- x 1))) 5 5))
    354354 ;=> #(5 8 9 8 5)
    355355
    356356(let ((count 0))
    357    (vector-map (λ (ignored-elt)
     357   (vector-map (lambda (ignored-elt)
    358358                 (set! count (+ count 1))
    359359                 count)
     
    381381
    382382<enscript highlight="scheme">
    383 (vector-for-each (λ (x) (display x) (newline))
     383(vector-for-each (lambda (x) (display x) (newline))
    384384                 '#("foo" "bar" "baz" "quux" "zot"))
    385385</enscript>
     
    452452
    453453<enscript highlight="scheme">
    454 (vector-index (λ (x1 x2 ...) (not (pred? x1 x1 ...)))
     454(vector-index (lambda (x1 x2 ...) (not (pred? x1 x1 ...)))
    455455                    vec1 vec2 ...)
    456456</enscript>
     
    470470
    471471<enscript highlight="scheme">
    472 (vector-index-right (λ (x1 x2 ...) (not (pred? x1 x1 ...)))
     472(vector-index-right (lambda (x1 x2 ...) (not (pred? x1 x1 ...)))
    473473                          vec1 vec2 ...)
    474474</enscript>
     
    487487
    488488<enscript highlight="scheme">
    489 (λ (char1 char2)
     489(lambda (char1 char2)
    490490  (cond ((char<? char1 char2) -1)
    491491        ((char=? char1 char2) 0)
Note: See TracChangeset for help on using the changeset viewer.