Both of those examples use half-open intervals :) The first selects the
subsequence with indices 1,2,3, and the second selects the subsequence with
indices 2,3. You can see in the second example that [2 3] in the overall
sequence is replaced by [-1 -1 -1].

On Thu, Jan 28, 2016 at 9:10 PM, Alan Thompson <clooj...@gmail.com> wrote:

> Looks great, Nathan.  I also highly enjoyed your recent interview on the
> Cognitect podcast  <http://blog.cognitect.com/cognicast/095>.
>
> One quick question:  In the first example below from the README (verified
> at the repl), it seems that the (srange ...) function sometimes behaves
> as a half-open interval [1,4) like the (range ...) function in Clojure).
> However, in the 2nd example it seems to behave as a closed interval [2,4].
> Is there an easy way of knowing which behavior applies in different
> situations?
>
> Thanks,
> Alan
>
>
> Here's how to increment all the odd numbers between indexes 1 (inclusive)
> and 4 (exclusive):
>
> user> (transform [(srange 1 4) ALL odd?] inc [0 1 2 3 4 5 6 7])
>
> [0 2 2 4 4 5 6 7]
>
> Here's how to replace the subsequence from index 2 to 4 with [-1 -1 -1]:
>
> user> (setval (srange 2 4) [-1 -1 -1] [0 1 2 3 4 5 6 7 8 9])
>
> [0 1 -1 -1 -1 4 5 6 7 8 9]
>
>
>
>
>
>
> On Thu, Jan 28, 2016 at 4:11 PM, Jean Baro <jfb...@gmail.com> wrote:
>
>>
>> Congratulations for the spectacular work and thanks for sharing this with
>> the world.
>>
>> --
>> 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.
>>
>
> --
> 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 a topic in the
> Google Groups "Clojure" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/clojure/XePZ-WSviso/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Twitter: @nathanmarz
http://nathanmarz.com

-- 
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