Re: Lookup on a symbol?

2011-11-27 Thread Bill Caputo
On Nov 24, 2011, at 12:32 AM, Sean Corfield wrote: @lloyda2 posted on Twitter: (reduce 'and '(false true)) = true ...Huh? I must admit, it looked odd to me... but I realized (after some REPL experimentation) this seems to be equivalent to ('some-symbol :some-key :some-default) I saw the

Re: Lookup on a symbol?

2011-11-27 Thread jongwon.choi
No that doesn't make any sense, but I (think I) know what is going on there. (:a 1 2) === (get 1 :a 2) Jong-won On Nov 25, 1:35 pm, jaime xiejianm...@gmail.com wrote: But we still don't know why it behaves like this and for what reason. does (:a 1 2) returns 2 make any sense?? -- You

Re: Lookup on a symbol?

2011-11-27 Thread jongwon.choi
I'd expect the same, but in the code (https://github.com/clojure/ clojure/blob/master/src/jvm/clojure/lang/RT.java) get and getFrom do not raise any error. On Nov 24, 6:30 pm, Sean Corfield seancorfi...@gmail.com wrote: (:a 1 2) yields 2 which surprises me a bit... I'd expect an error because

Re: Lookup on a symbol?

2011-11-24 Thread jaime
But we still don't know why it behaves like this and for what reason. does (:a 1 2) returns 2 make any sense?? On Nov 24, 3:30 pm, Sean Corfield seancorfi...@gmail.com wrote: On Wed, Nov 23, 2011 at 9:48 PM, Alan Malloy a...@malloys.org wrote: Other way round. It behaves like a keyword,

Re: Lookup on a symbol?

2011-11-24 Thread Meikel Brandmeyer (kotarak)
Hi, the usual argument is, that this statement itself is undefined. 1 is not a collection. So it is not in the domain of the keyword (seen as a function). Keywords could throw an exception, or behave as they behave. There is no right solution. Just different opinions. And Rich obviously

Lookup on a symbol?

2011-11-23 Thread Sean Corfield
@lloyda2 posted on Twitter: (reduce 'and '(false true)) = true ...Huh? I must admit, it looked odd to me... but I realized (after some REPL experimentation) this seems to be equivalent to ('some-symbol :some-key :some-default) and that attempts (and fails) to somehow lookup :some-key in

Re: Lookup on a symbol?

2011-11-23 Thread Alan Malloy
Other way round. It behaves like a keyword, looking itself up in a map: ('x '{x 1 y 2}) yields 2. You see the same behavior with (reduce :and [5 10]), yielding 10. On Nov 23, 9:32 pm, Sean Corfield seancorfi...@gmail.com wrote: @lloyda2 posted on Twitter: (reduce 'and '(false true)) = true

Re: Lookup on a symbol?

2011-11-23 Thread Sean Corfield
On Wed, Nov 23, 2011 at 9:48 PM, Alan Malloy a...@malloys.org wrote: Other way round. It behaves like a keyword, looking itself up in a map: ('x '{x 1 y 2}) yields 2. You see the same behavior with (reduce :and [5 10]), yielding 10. Ah... I didn't realize that the lookup could be done without