On Tue, Dec 10, 2013 at 11:46 PM, Cedric Greevey wrote:
> On Tue, Dec 10, 2013 at 6:29 PM, Vincent Chen wrote:
>>
>> Try this (not tested, might be missing parens and whatnot):
>>
>> (defn slice [x s n]
>> (loop [[h & tail] x, s s, n n, acc []]
>> (cond
>> (zero? n) acc
>> (zero
On Tue, Dec 10, 2013 at 6:29 PM, Vincent Chen wrote:
> Try this (not tested, might be missing parens and whatnot):
>
> (defn slice [x s n]
> (loop [[h & tail] x, s s, n n, acc []]
> (cond
> (zero? n) acc
> (zero? s) (recur tail s (dec n) (conj acc h))
> :else (recur tail (
On Tue, Dec 10, 2013 at 11:09 PM, Glen Mailer wrote:
> I was recently working on some toy recursion problems, when I ran into a
> function that I can express simply using normaly recursion, but I can't seem
> to convert it into a form that works nicely with loop/recur.
>
> It's certainly not the r
On Tue, Dec 10, 2013 at 6:09 PM, Glen Mailer wrote:
> I was recently working on some toy recursion problems, when I ran into a
> function that I can express simply using normaly recursion, but I can't
> seem to convert it into a form that works nicely with loop/recur.
>
> It's certainly not the r
I was recently working on some toy recursion problems, when I ran into a
function that I can express simply using normaly recursion, but I can't
seem to convert it into a form that works nicely with loop/recur.
It's certainly not the right way to solve this problem, but I'm intrigued
to see wha