Changeset 39486 in project


Ignore:
Timestamp:
01/06/21 17:35:32 (11 days ago)
Author:
juergen
Message:

dotted-lambdas 1.1 docu

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/5/dotted-lambdas

    r38998 r39486  
    1010last item is one of the symbols .., ... or ....
    1111
    12 The meaning of theses symbols, which are ledal identifiers, is
     12The meaning of theses symbols, which are legal identifiers, is
    1313
    1414* two dots:   the argument to the left references a callable list
     
    6060The last one evaluates to ordinary (lambda (x ...) xpr . xprs)
    6161
     62==== define
     63 
     64<macro>(define* (name x ... xs ..) xpr . xprs)</macro>
     65
     66<macro>(define* (name x ... xs ...) xpr . xprs)</macro>
     67
     68<macro>(define* (name x ... xs ....) xpr . xprs)</macro>
     69
     70<macro>(define* (name x ...) xpr . xprs)</macro>
     71
     72<macro>(define name (lambda* (x ... xs ..) xpr . xprs))</macro>
     73
     74syntactic sugar for, e.g.
     75
    6276==== dotted-lambdas
    6377 
     
    123137;-> (quote ())
    124138
     139(define* (inc x i ..) (+ x (optional (i) 1)))
     140
     141(define* (foo x y zs ...) (list x y (zs)))
     142
     143(define* (bar x ys ....) (list x (ys)))
     144
     145(define* (baz xs ..) (list (xs)))
     146
     147(inc 5)
     148;-> 6
     149
     150(inc 5 3)
     151;-> 8
     152
     153(foo 1 2 3 4)
     154;-> (quote (1 2 (3 4)))
     155
     156(foo 1 2)
     157;-> (quote (1 2 ()))
     158
     159(bar 1 2 3 4)
     160;-> (quote (1 (2 3 4)))
     161
     162(condition-case (bar 1) ((exn) #f))
     163;-> #f
     164
     165(baz 1)
     166;-> (quote ((1)))
     167
     168(condition-case (baz 1 2) ((exn) #f))
     169;-> #f
     170
    125171</enscript>
    126172
     
    132178== Last update
    133179
    134 Sep 4, 2020
     180Jan 6, 2021
    135181
    136182== Author
     
    140186== License
    141187
    142 Copyright (c) 2020 , Juergen Lorenz, ju (at) jugilo (dot) de
     188Copyright (c) 2021 , Juergen Lorenz, ju (at) jugilo (dot) de
    143189All rights reserved.
    144190
     
    170216
    171217== Version history
     218; 1.1 : define* added
    172219; 1.0 : Initial check in
Note: See TracChangeset for help on using the changeset viewer.