<div dir="ltr">Oh! Really. Thank you! Sorry, I am not experienced in Racket.<br> </div><div class="gmail_extra"><br><div class="gmail_quote">2014-10-02 0:56 GMT+04:00 Matthias Felleisen <span dir="ltr"><<a href="mailto:matthias@ccs.neu.edu" target="_blank">matthias@ccs.neu.edu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
In this context, null is just a variable and it gets bound to what it matches:<br>
<br>
> Welcome to Racket v6.1.0.8.<br>
> > (match 'hello-world [null null])<br>
> 'hello-world<br>
<div><div class="h5"><br>
<br>
<br>
On Oct 1, 2014, at 4:52 PM, Yuri Garmay <<a href="mailto:yuri.from.spb@gmail.com">yuri.from.spb@gmail.com</a>> wrote:<br>
<br>
> Hi, all<br>
><br>
> Accidentally, I found out that null matchs in unexpected way (seems it matchs always)<br>
><br>
> So,<br>
> (define (length-my list)<br>
>   (match list<br>
>     ['() 0]<br>
>     [(cons x xs)<br>
>      (+ 1<br>
>         (length-my xs))]<br>
>     [_ 'not-a-list]))<br>
> (length-my '(1 2 3 4))<br>
> >produces 4<br>
><br>
> But<br>
> (define (length-my list)<br>
>   (match list<br>
>     [null 0]<br>
>     [(cons x xs)<br>
>      (+ 1<br>
>         (length-my xs))]<br>
>     [_ 'not-a-list]))<br>
> (length-my '(1 2 3 4))<br>
> >produces 0<br>
><br>
> I also tried that:<br>
> (match '213423<br>
>   [null 0]<br>
>   [_ 1])<br>
> >produces 0<br>
> (match null<br>
>   ['213423 0]<br>
>   [_ 1])<br>
> >produces 1<br>
><br>
> Is it a bug?<br>
><br>
> I am using Racket 6.1<br>
><br>
> --<br>
> Best regards,<br>
> Yuri<br>
><br>
</div></div>> ____________________<br>
>  Racket Users list:<br>
>  <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>Best regards,<div>Yuri<br><div><br></div></div>
</div>