[racket] strange behaviour of a (match) form
Hi, all
Accidentally, I found out that null matchs in unexpected way (seems it
matchs always)
So,
(define (length-my list)
(match list
['() 0]
[(cons x xs)
(+ 1
(length-my xs))]
[_ 'not-a-list]))
(length-my '(1 2 3 4))
>produces 4
But
(define (length-my list)
(match list
[null 0]
[(cons x xs)
(+ 1
(length-my xs))]
[_ 'not-a-list]))
(length-my '(1 2 3 4))
>produces 0
I also tried that:
(match '213423
[null 0]
[_ 1])
>produces 0
(match null
['213423 0]
[_ 1])
>produces 1
Is it a bug?
I am using Racket 6.1
--
Best regards,
Yuri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20141002/adbadaf0/attachment.html>