Thanks Aaron. Very neat!

On Aug 24, 7:05 pm, Aaron Cohen <aa...@assonance.org> wrote:
> One way:
>
> user=>(concat (range 5) (range 5 0 -1))
> (0 1 2 3 4 5 4 3 2 1)
>
> user=>(take 15 (cycl­e (conc­at (rang­e 5) (rang­e 5 0 -1)))­))
> (0 1 2 3 4 5 4 3 2 1 0 1 2 3 4)
>
> On Wed, Aug 24, 2011 at 6:49 PM, HiHeelHottie <hiheelhot...@gmail.com>wrote:
>
>
>
>
>
>
>
>
>
> > How can you generate a sequence of numbers from 0 to n and back? Here
> > is my try.
>
> > user> (require '(clojure.contrib [math :as math]))
> > nil
> > user>  (take 15 (let [n 3] (drop n (map #(math/abs (- (mod % (* n 2))
> > n)) (range)))))
> > (0 1 2 3 2 1 0 1 2 3 2 1 0 1 2)
>
> > --
> > 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