On Saturday, April 4, 2015 at 1:00:46 PM UTC-4, Michael Gardner wrote:
>
> On Sat, Apr 4, 2015 at 11:36 AM, Paul Roush <pro...@gmail.com 
> <javascript:>> wrote:
>
>> (range  5N) => (0 1 2 3 4)      ;  i.e. the "bigint-ness" is lost
>>
>> So in this particular case I needed to "inject" bigint into the process 
>> later in some way.
>>
>
> You could try (range (* 0 n) n). A little silly, but does avoid the 
> conditional.
>
> You could consider also creating a JIRA issue asking for range to match 
> the type of its argument in the 1-arity case. No idea whether it would be 
> accepted, though. 
>

Interesting.  My code was actually calling range with 2 args, as I want a 
1-based range.  The 1 was a literal, and to support the non-bigint case I 
don't want to hardwire it to 1N.  Now I see that:

(range 1N 5N) => (1N  2N 3N 4N)
(range 1 5N) => (1 2 3 4)

So I could pass (/ n n ) as my first arg to range and I'll get the desired 
type in all cases.

But this behavior of 'range' now feels quirky to me.

-- 
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/d/optout.

Reply via email to