Hi Jarek,
Sometimes you want an exception to be thrown if an element in a collection
is not available, sometimes you want to deal with nil. I guess it depends on
your application of whether you'd go with get or nth. There's no wrong or
right here.
Andreas


On 13 June 2011 17:51, Jarek Siembida <[email protected]> wrote:

> > (nth [] 0) also throws an exception, so it is not so surprising.
>
> Thanks guys, just checked, rand-nth as a wrapper around
> nth inherits its semantics. So the question should rather be
> why nth throws an exception while get not.
> Out of curiosity I checked (peek []), returns nil too.
>
> jarek
>
> --
> In theory, there is no difference between theory and practice.
> But in practice, there is.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> 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
>



-- 
**********************************************************
Andreas Koestler, Software Engineer
Leica Geosystems Pty Ltd
270 Gladstone Road, Dutton Park QLD 4102
Main: +61 7 3891 9772     Direct: +61 7 3117 8808
Fax: +61 7 3891 9336
Email: [email protected]

************www.leica-geosystems.com*************

when it has to be right, Leica Geosystems

Please  consider the environment before printing this email.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
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