n00b question: Why is [1 2 3] idiomatic and not '(1 2 3) ?  Is it a
vectors vs. lists thing, notation thing, or something else?

I don't have a lisp background so there's a truckload of lisp reading
I still want to do which may answer questions like these for me.  If
there's a particular text on what would help a person discern
idiomatic vs. not, in clojure, I'd be happy to put that on my "list"
'(ha ha).  :P

Ryan

On Fri, Jul 2, 2010 at 9:50 AM, Meikel Brandmeyer <m...@kotka.de> wrote:
> Hi,
>
> On Jul 2, 12:18 pm, Walter van der Laan <waltervanderl...@gmail.com>
> wrote:
>
>> For example you can point your browser 
>> athttp://getclojure.org:8080/examples/reduce
>> for reduce examples.
>
> Is it necessary to have >250 examples for a function which has
> effectively five variations?
>
> (reduce + [])
> (reduce + [1])
> (reduce + [1 2 3])
> (reduce + 0 [])
> (reduce + 0 [1 2 3])
>
> Then there are examples like this one:
> (reduce '* '(1 2 3))
>
> Someone who is new to Clojure and tries to understand reduce... Does
> he understand why the result is 3? A result which relies on a not very
> well-known fact, that you can actually call symbols like keywords for
> map lookup with up to two arguments. (I bet there quite a few of
> "seasoned" clojurians who didn't know that) I - if I was a newbie to
> the language - would mainly think: wtf? Additionally the particular
> example above doesn't even make sense.
>
> I'm all for examples, but please: clear examples focusing on the thing
> being demonstrated. Symbol calling or showing that [1 2 3] and (list 1
> 2 3) can be interchanged in the example above are nice to know, but
> don't help to understand reduce itself. They should go to their own
> sections in a tutorial.
>
> The 0.02€ of a guy who has not put effort in creating examples for the
> core API.
>
> Sincerely
> Meikel
>
> PS: I also think the examples should demonstrate idiomatic clojure. [1
> 2 3] is idiomatic while '(1 2 3) is not. Whatever we put in examples
> will show up in code. So be it [] vs. '() or (.java interop) vs. (.
> interop (java)) - we should pay attention!
>
> --
> 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
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to