Re: safe navigation operator

2008-10-06 Thread Parth Malwankar
On Oct 6, 7:00 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Oct 6, 9:36 am, Stuart Halloway <[EMAIL PROTECTED]> wrote: > > > > > Yes, that's better. Glad you like the idea. > > > Does anybody not named Stuart also want to see this added to > > Clojure? ;-) > > > Stuart > > > > On Oct 3, 3:13

Re: safe navigation operator

2008-10-06 Thread Stuart Sierra
On Oct 6, 10:00 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > I'm not opposed, but we'll need to find another name. Leading ? is a > likely candidate for rule syntax, and trailing means predicate. > > .?. > > ? Or, more verbosely, "nilsafe.." -Stuart Sierra --~--~-~--~~~--

Re: safe navigation operator

2008-10-06 Thread Stuart Halloway
> .?. OK with me. Needs a dorky name to match. :-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send

Re: safe navigation operator

2008-10-06 Thread Paul Stadig
.? kinda almost works. It's not exactly a predicate, but it means "access this member if not null". Or perhaps .* which would mean "access as many members as possible in the following list". Paul On Mon, Oct 6, 2008 at 10:00 AM, Rich Hickey <[EMAIL PROTECTED]> wrote: > > > > On Oct 6, 9:36 am,

Re: safe navigation operator

2008-10-06 Thread Rich Hickey
On Oct 6, 9:36 am, Stuart Halloway <[EMAIL PROTECTED]> wrote: > Yes, that's better. Glad you like the idea. > > Does anybody not named Stuart also want to see this added to > Clojure? ;-) > > Stuart > > > On Oct 3, 3:13 pm, Stuart Halloway <[EMAIL PROTECTED]> wrote: > >> (defmacro ?. > >>"li

Re: safe navigation operator

2008-10-06 Thread Stuart Halloway
Yes, that's better. Glad you like the idea. Does anybody not named Stuart also want to see this added to Clojure? ;-) Stuart > On Oct 3, 3:13 pm, Stuart Halloway <[EMAIL PROTECTED]> wrote: >> (defmacro ?. >>"like .. but drops out on null object" >>([x form] >> `(. ~x ~form)) >>

Re: safe navigation operator

2008-10-03 Thread Stuart Sierra
On Oct 3, 3:13 pm, Stuart Halloway <[EMAIL PROTECTED]> wrote: > (defmacro ?. >    "like .. but drops out on null object" >    ([x form] >       `(. ~x ~form)) >    ([x form & more] >       `(if-let x# (. ~x ~form) (.? x# [EMAIL PROTECTED] Interesting -- I like it. It doesn't seem to be total

safe navigation operator

2008-10-03 Thread Stuart Halloway
Groovy has a safe navigation operator. Yes, this probably enables Law of Demeter violations, but it is darn useful when you are dealing with existing Java APIs that required lots.of.dotted.notation. I would like to have this in Clojure. Anybody else like it? (defmacro ?. "like .