Re: interesting puzzle

2010-01-29 Thread Meikel Brandmeyer
Hi, Am 29.01.2010 um 20:45 schrieb Wilson MacGyver: > I had assumed when he wrote "do not use iteration", > what he meant is to "not use for/next loop" That's how I understood it. Especially since all solutions at the pastie link more or less use recursion. (Even when they cheat and call out to

Re: interesting puzzle

2010-01-29 Thread Wilson MacGyver
I had assumed when he wrote "do not use iteration", what he meant is to "not use for/next loop" otherwise, as you said, we can't solve the problem without examining the sequence. On Fri, Jan 29, 2010 at 2:38 PM, Meikel Brandmeyer wrote: > Hi, > > Am 29.01.2010 um 16:25 schrieb Wilson MacGyver: >

Re: interesting puzzle

2010-01-29 Thread Meikel Brandmeyer
Hi, Am 29.01.2010 um 16:25 schrieb Wilson MacGyver: > I saw this on twitter. > > http://pastie.org/796264 > > The problem: given a list of strings, produce a list where sequential > non-empty strings are concatenated > > # Conditions: Do not use iteration. > # > # Example: glom (["a", "b", "c"

Re: interesting puzzle

2010-01-29 Thread Sean Devlin
Using seq-utils... 1. Assume " " is NOT empty 2. Use partition-by to split 3. Use remove to clean up 4. Map! user=>(map (partial apply str) (remove (comp empty? first) (partition-by empty? ["a" "" "b" "c"]))) ("a" "bc") I think this satisfies you conditions. Sean On Jan 29, 10:25 am,

interesting puzzle

2010-01-29 Thread Wilson MacGyver
I saw this on twitter. http://pastie.org/796264 The problem: given a list of strings, produce a list where sequential non-empty strings are concatenated # Conditions: Do not use iteration. # # Example: glom (["a", "b", "c"]) = ["abc"] # glom (["a", "", "b"]) = ["a", "b"] # glom