|
From: | Panicz Maciej Godek |
Subject: | Re: Matching lambdas proposal |
Date: | Sat, 30 Nov 2013 20:43:31 +0100 |
Although it's not in the manual, we already have this. It's called
'match-lambda' and 'match-lambda*' in (ice-9 match). 'match-lambda'
creates a procedure that accepts a single argument, and does pattern
matching on that argument. 'match-lambda*' matches the entire argument
list.
(use-modules (ice-9 match))
(define f (match-lambda ((a . b) (+ a b))))
(f (cons 3 4)) => 7
[Prev in Thread] | Current Thread | [Next in Thread] |