<div dir="ltr"><div><div><div>Is this really a need? I really wouldn't bother to have<br></div>> (object-name empty?)<br></div>'null?<br><br></div>(I have no strong opinion on the subject though, I'm just wondering if there is a pratical different too)<br>

<div><br>Laurent<br><div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Mar 7, 2014 at 12:27 PM, Jens Axel Søgaard <span dir="ltr"><<a href="mailto:jensaxel@soegaard.net" target="_blank">jensaxel@soegaard.net</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The (define (empty? l) (null? l)) is needed due to object-name.<br>
<br>
> (object-name null?)<br>
'null?<br>
> (object-name empty?)<br>
'empty?<br>
> (define my-empty? empty?)<br>
> (object-name my-empty?)<br>
'empty?<br>
<br>
/Jens Axel<br>
<br>
<br>
2014-03-07 12:19 GMT+01:00 Ryan Davis <<a href="mailto:zenspider@gmail.com">zenspider@gmail.com</a>>:<br>
<div class="HOEnZb"><div class="h5">><br>
> On Mar 7, 2014, at 2:45, Daniel Carrera <<a href="mailto:dcarrera@gmail.com">dcarrera@gmail.com</a>> wrote:<br>
><br>
>> Hello,<br>
>><br>
>> Is there any difference between `first` and `car`, or between `last` and `cdr`, or between `empty? and null?` ?<br>
>><br>
>> I had assumed that these were just synonyms, added by Racket because they might be more memorable to a student. But apparently Racket doesn't think they are equal:<br>
>><br>
>> -> (equal? first car)<br>
>> #f<br>
>> -> (equal? last cdr)<br>
>> #f<br>
>> -> (equal? empty? null?)<br>
>> #f<br>
>><br>
>><br>
>> I suppose that they could be separate functions that happen to do the same thing, but if so, my next question would be why they aren't just aliases. As in:<br>
>><br>
>> -> (define myfirst car)<br>
>> -> (equal? myfirst car)<br>
><br>
> For many/most things in racket, you can bring up the definition for something inside of DrRacket:<br>
><br>
> (define (first x)<br>
>   (if (and (pair? x) (list? x))<br>
>     (car x)<br>
>     (raise-argument-error 'first "(and/c list? (not/c empty?))" x)))<br>
><br>
> I couldn't for car, so I'm assuming it is considered a primitive.<br>
><br>
> last and cdr aren't synonymous:<br>
><br>
> (define (last l)<br>
>   (if (and (pair? l) (list? l))<br>
>     (let loop ([l l] [x (cdr l)])<br>
>       (if (pair? x)<br>
>         (loop x (cdr x))<br>
>         (car l)))<br>
>     (raise-argument-error 'last "(and/c list? (not/c empty?))" l)))<br>
><br>
><br>
> (define (empty? l) (null? l))<br>
><br>
> null? seems to be a primitive as well. Not sure why they're not direct synonyms in this case.<br>
><br>
><br>
> ____________________<br>
>   Racket Users list:<br>
>   <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br>
<br>
<br>
</div></div><div class="im HOEnZb">--<br>
--<br>
Jens Axel Søgaard<br>
<br>
</div><div class="HOEnZb"><div class="h5">____________________<br>
  Racket Users list:<br>
  <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
</div></div></blockquote></div><br></div></div></div></div></div></div>