[racket] Which match macro is correct?

From: Carl Eastlund (cce at ccs.neu.edu)
Date: Tue Oct 11 23:34:22 EDT 2011

Niitsuma,

Neither macro is incorrect, but there is no standard for a "match"
macro in Scheme.  Gauche and Racket have different pattern languages
for their match macros.  See their respective documentation at:

http://practical-scheme.net/gauche/man/gauche-refe_176.html
http://docs.racket-lang.org/reference/match.html

Carl Eastlund

On Tue, Oct 11, 2011 at 11:23 PM, Niitsuma Hirotaka
<hirotaka.niitsuma at gmail.com> 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
> ------------
>
> Ok
> ------------
> #lang scheme
>  (require racket/match)
> (match '(0 (1 2) (3 4 5))
>  [(list a (list b c) (list d e f))
>   (list a b c d e f)])
>
> (match '(0 (1 2) (3 4 5))
>  [`(,a (,b ,c) (,d ,e ,f))
>   (list a b c d e f)])
> ------------



Posted on the users mailing list.