Re: Repeating a vector n times

2011-07-13 Thread Ken Wesson
On Wed, Jul 13, 2011 at 5:17 PM, Sam Ritchie wrote: > Ken, that'll result in the original vector back out again. > (vec (take 3 (cycle [1 2 3]))) => [1 2 3]. > I think you mean: > (vec (take (* n (count xs)) (cycle xs I wasn't using "n" to mean the number of repetitions of the xs but the tota

Re: Repeating a vector n times

2011-07-13 Thread Sam Ritchie
Ken, that'll result in the original vector back out again. (vec (take 3 (cycle [1 2 3]))) => [1 2 3]. I think you mean: (vec (take (* n (count xs)) (cycle xs On Wed, Jul 13, 2011 at 5:13 PM, Ken Wesson wrote: > On Wed, Jul 13, 2011 at 11:21 AM, Bhinderwala, Shoeb > wrote: > > Thanks Tamr

Re: Repeating a vector n times

2011-07-13 Thread Ken Wesson
On Wed, Jul 13, 2011 at 11:21 AM, Bhinderwala, Shoeb wrote: > Thanks Tamreen. Your solution will have to be wrapped in another vec call. I > will use Miekel’s: > > > >    (reduce into [] (repeat n xs)). What about (vec (take n (cycle xs)))? -- Protege: What is this seething mass of parentheses?

RE: Repeating a vector n times

2011-07-13 Thread Bhinderwala, Shoeb
11 11:02 AM To: clojure@googlegroups.com Subject: Re: Repeating a vector n times Damn, Meikel's solution is better, I was thinking: (apply concat (repeat n xs)) On Wed, Jul 13, 2011 at 10:54 AM, Bhinderwala, Shoeb wrote: I have to write a function that will take a vector as input,

Re: Repeating a vector n times

2011-07-13 Thread Tamreen Khan
Damn, Meikel's solution is better, I was thinking: (apply concat (repeat n xs)) On Wed, Jul 13, 2011 at 10:54 AM, Bhinderwala, Shoeb < sabhinderw...@wellington.com> wrote: > ** > > I have to write a function that will take a vector as input, repeat the > elements multiple times and return back a