Changeset 32952 in project


Ignore:
Timestamp:
12/01/15 17:05:18 (5 years ago)
Author:
juergen
Message:

procedural-macros 1.0.3 docu

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/procedural-macros

    r32943 r32952  
    8989groups each symbol with the location of a runtime object, using gensyms
    9090to step down the pattern while grouping the gensym bound object with all
    91 pairs depending on this gensym. So, for example, (destruc '(a (b . c) . d) 'seq)
     91pairs depending on this gensym. So, for example,
     92
     93<enscript highlight=scheme>
     94(destruc '(a (b . c) . d) 'seq)
     95</enscript>
     96
    9297will result in
    9398
     
    113118sequences. Indeed, for macro-writing macros lists are sufficient, I
    114119think. But off course, I have to provide some extensions to Graham's
    115 code, length checks, wildcards, non-symbol literals, as in the bindings
    116 egg.  wildcards and nonsymbol literals bind nothing, the former matching
    117 anything, the latter only themselfs.
     120code, length checks and non-symbol literals, as in the bindings
     121egg; but contrary to that egg, wildcards are omitted, out of hygiene
     122reasons. Nonsymbol literals bind nothing but match only to themselfs.
    118123
    119124The last feature missing is fenders, which is important in particular
    120125for macro-rules and can easily be implemented with a where clause: A
    121 pattern matches successfully if only each pattern variable can be bound
    122 and the where clause is satisfied. If the where clause doesn't pass the
    123 next pattern is tried.
     126pattern matches successfully if only each pattern variable can be bound,
     127the length checks pass, the literals match themselfs and the where
     128clause is satisfied. If any of those conditions is hurt, the next
     129pattern is tried.
    124130
    125131=== The module procedural-macros
     
    263269;; procedural version of letrec
    264270(define-macro (my-letrec var-val-pairs . body)
    265               (where ((list-of (bindable? (var val)))
    266                       var-val-pairs))
     271              (where ((list-of? pair?) var-val-pairs))
    267272  (let ((vars (map car var-val-pairs))
    268273        (vals (map cadr var-val-pairs))
     
    334339== Last update
    335340
    336 Nov 27, 2015
     341Dec 01, 2015
    337342
    338343== Author
     
    372377
    373378== Version History
     379; 1.0.3 : wildcards ommitted, out of hygiene reasons
    374380; 1.0.2 : documentation procedure exported
    375381; 1.0.1 : bug fix in literals
Note: See TracChangeset for help on using the changeset viewer.