It is necessary - integer literals default to primitive long and I'm not
sure if >= will inline if it doesn't have type information in scope. This
bit of noise could probably be removed by improving type inference in the
compiler.


On Thu, May 16, 2013 at 3:09 PM, Pavel Prokopenko <
pavel.a.prokope...@gmail.com> wrote:

> Hi,
>
> I've been reading Clojure sources in order to get a better understanding
> of how and why things work and found this implementation of nth function
> in src/clj/clojure/gvec.clj:
>
>   (nth [this i not-found]
>        (let [z (int 0)]
>          (if (and (>= i z) (< i (.count this)))
>            (.nth this i)
>            not-found)))
>
>
> The question might sound weird, but anyway..  Is there any reason for
> doing so instead of:
>
>
>   (nth [this i not-found]
>          (if (and (>= i 0) (< i (.count this)))
>            (.nth this i)
>            not-found))
>
>
> or is it just a matter of taste? I'm just curious because the first form 
> seems more verbose and doesn't improve readability, though it's not complex 
> either.
>
>
> Thanks.
>
>  --
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to