Arc Forumnew | comments | leaders | submitlogin
2 points by mdh 6308 days ago | link | parent

My apologies, I was foolish in that I did not consider that '() evals to nil prior to the evaluation of rev. (rev nil) --> nil - this now makes more sense.

A couple more observations on this point:

(list) --> ()

((fn nil 'a)) --> a

(type (list)) --> sym

Is there any valid use of the '() syntax other than zero parameter declarations in functions? It would appear that in arc, one should embrace nil.



5 points by sacado 6308 days ago | link

Personally, I use '() when I mean "the empty list" and nil when I mean either "the false boolean" or "no value yet". It is just a matter of readability, since they're both as long to type ;)

-----

4 points by bogomipz 6308 days ago | link

Simply () works too, and is more than 33% shorter ;)

The following shows four ways to express the empty list, and proves that they mean the same in Arc. What's a little peculiar, however, is that one gets printed differently;

  arc> (is () '() nil 'nil)
  t
  arc> ()
  ()
  arc> '()
  nil
  arc>

-----

1 point by absz 6308 days ago | link

In Arc, they are equivalent, so it doesn't really matter. I think pg would like us all to use nil everywhere, but (obviously) that's not being enforced. Nevertheless, based on arc.arc, I think "embracing nil" is probably the best idea.

-----