[racket] Which match macro is correct?
On 10/11/2011 09:23 PM, Niitsuma Hirotaka wrote:
> on Gauche
>
> work
> ------------
> (use srfi-1)
> (use util.match)
> (match '(0 (1 2) (3 4 5))
> [(a (b c) (d e f))
> (list a b c d e f)]) ;;note this case
>
> (match '(0 (1 2) (3 4 5))
> [`(,a (,b ,c) (,d ,e ,f))
> (list a b c d e f)])
> ------------
>
> on Racket
>
> Err
> ------------
> #lang scheme
> (require racket/match)
> (match '(0 (1 2) (3 4 5))
> [(a (b c) (d e f))
> (list a b c d e f)])
> ;=> match: syntax error in pattern in: (a (b c) (d e f)) ;;compare to gouche
> ------------
If you want to use that syntax for patterns, use the mzlib/match legacy
library instead of racket/match. But if you're writing new Racket code,
racket/match is preferred.
Ryan