On Nov 29, 6:03 pm, "Ralf Bensmann" <[EMAIL PROTECTED]>
wrote:
> But #(...) and (fn [] ...) should be the same?

I suppose that might make the syntax somewhat ugly.
E.g.:
(fn [x] (foo x)) would become #((foo %)).

This particular syntax is a frequent point of confusion but
then once you get it its cleaner. The current syntax fits the
common case better where you might do #(foo %1 %2) sort
of a thing.

I suppose once an FAQ for Clojure comes up this goes there :)

Parth


>
> On Sat, Nov 29, 2008 at 1:48 PM, Parth Malwankar
> <[EMAIL PROTECTED]>wrote:
>
>
>
> > On Nov 29, 5:29 pm, "Ralf Bensmann" <[EMAIL PROTECTED]>
> > wrote:
> > > Hi,
>
> > > is this the intended behavior?
>
> > > user=> #(nil)
> > > java.lang.NullPointerException (NO_SOURCE_FILE:12)
> > > user=> (def b #(nil))
> > > java.lang.NullPointerException (NO_SOURCE_FILE:13)
>
> > This is expected.
> > #(nil) is the same as (fn [] (nil)) and hence the failure.
> > (fn [] nil) is what you want.
>
> > > This works:
> > > user=> #('nil)
> > > #<user$eval__43$fn__45 [EMAIL PROTECTED]>
>
> > I am not very clear on whats happening here to comment.
>
> > Parth
>
> > > Thanks,
> > > -Ralf
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to