[racket] Neophyte Alert

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Wed Aug 31 17:05:02 EDT 2011

On Aug 31, 2011, at 4:43 PM, Jukka Tuominen wrote:

> 
>> 
>> A few minutes ago, Neil Van Dyke wrote:
>>> Josh Tilles wrote at 08/31/2011 01:03 PM:
>>>> -- Is there any sort of general practice or prevailing taste in when
>>>> to use (for example) *null* vs *empty* vs *(list)*? What about *(let
>>>> ([...]))* vs *(local (define ...))*?
>>> 
>>> I think most people do "'()" when they want a literal null list.
>>> Don't use "(list)", since that's a procedure call.
>> 
>> Two quick notes: (list) would be optimized the same, I think; and at
>> least in the Racket sources I think that `null' is the more popular
>> choice.  (With `empty' winning in the more HtDP-oriented side.)
>> 
> 
> #lang racket a.k.a. default language seems to be clear on this one when
> evaluated
> 
> (list) >>  '()  didn't know this one myself
> empty  >>  '()
> null   >>  '()
> '()    >>  '()


I'd stick with '() and HtDP/2e will move there. 




> Then what is the 'correct' predicate to go with?
> 
> empty?
> null?
> 
> anything else?


I'd stick with empty?. History brought in car, cdr, null? and null and that's bad because programmers may accidentally connect this to Java's NULL, which is a horrible idea. 






Posted on the users mailing list.