Changeset 29949 in project


Ignore:
Timestamp:
10/23/13 10:01:06 (8 years ago)
Author:
svnwiki
Message:

Anonymous wiki edit for IP [213.250.31.28]: TOC and an example.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/matchable

    r23848 r29949  
    44
    55This extension implements Andrew Wright's pattern matching macros.
     6
     7[[toc:]]
    68
    79=== Overview
     
    6365The {{match-lambda*}} form constructs a function that accepts any number
    6466of arguments; the patterns of {{match-lambda*}} should be lists.
     67
     68For example, the {{map}} procedure can be written as:
     69
     70<enscript highlight=scheme>
     71(define map
     72  (match-lambda*
     73    [(_ ()) '()]
     74    [(f (x . y)) (cons (f x) (map f y))] ))
     75</enscript>
    6576
    6677<macro>(match-let [var] ((pat exp) 
) body 
)</macro><br>
Note: See TracChangeset for help on using the changeset viewer.