Changeset 39486 in project
- Timestamp:
- 01/06/21 17:35:32 (11 days ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wiki/eggref/5/dotted-lambdas
r38998 r39486 10 10 last item is one of the symbols .., ... or .... 11 11 12 The meaning of theses symbols, which are le dal identifiers, is12 The meaning of theses symbols, which are legal identifiers, is 13 13 14 14 * two dots: the argument to the left references a callable list … … 60 60 The last one evaluates to ordinary (lambda (x ...) xpr . xprs) 61 61 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 74 syntactic sugar for, e.g. 75 62 76 ==== dotted-lambdas 63 77 … … 123 137 ;-> (quote ()) 124 138 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 125 171 </enscript> 126 172 … … 132 178 == Last update 133 179 134 Sep 4, 2020 180 Jan 6, 2021 135 181 136 182 == Author … … 140 186 == License 141 187 142 Copyright (c) 202 0, Juergen Lorenz, ju (at) jugilo (dot) de188 Copyright (c) 2021 , Juergen Lorenz, ju (at) jugilo (dot) de 143 189 All rights reserved. 144 190 … … 170 216 171 217 == Version history 218 ; 1.1 : define* added 172 219 ; 1.0 : Initial check in
Note: See TracChangeset
for help on using the changeset viewer.