code golf

2008-12-17 Thread rzeze...@gmail.com
Neat challenge on stackoverflow: http://stackoverflow.com/questions/372668/code-golf-how-do-i-write-the-shortest-character-mapping-program I added an implementation in Clojure. One that I'm sure could be greatly improved on. I don't really care for the extremely obfuscated examples. Sure

Re: code golf

2008-12-17 Thread Chouser
On Wed, Dec 17, 2008 at 6:15 PM, rzeze...@gmail.com rzeze...@gmail.com wrote: Neat challenge on stackoverflow: http://stackoverflow.com/questions/372668/code-golf-how-do-i-write-the-shortest-character-mapping-program I added an implementation in Clojure. One that I'm sure could be greatly

Re: code golf

2008-12-17 Thread Stephen C. Gilardi
On Dec 17, 2008, at 8:09 PM, Chouser wrote: But I can't deny that golfing is fun! Yes it is! (defn enc[s e](apply str(map(into{}(for[[o _ n](partition 3 4 e)][o n]))s))) Nice job as usual, Chouser! Here's my stroke--now shown to have landed well into the rough: (defn enc[p t](let[a

Re: code golf

2008-12-17 Thread rzeze...@gmail.com
On Dec 17, 8:09 pm, Chouser chou...@gmail.com wrote: I don't think I agree with the premise of the question, that golf answers help anyone learn about other languages. But I can't deny that golfing is fun! (defn enc[s e](apply str(map(into{}(for[[o _ n](partition 3 4 e)][o n]))s))) I

Re: code golf

2008-12-17 Thread Mark Engelberg
78? I count 72 after you take out all the superfluous spaces. But I agree that it says nothing significant about the language. It's a fun optimization puzzle, though, and can help understand whether the built-in library of functions is fairly rich.

Re: code golf

2008-12-17 Thread Chouser
On Wed, Dec 17, 2008 at 9:53 PM, Mark Engelberg mark.engelb...@gmail.com wrote: This shaves 14 characters off of Chouser's solution: (defn enc[s e](apply str(map(apply hash-map(take-nth 2 e))s))) Very nice! --Chouser --~--~-~--~~~---~--~~ You received this

Re: code golf

2008-12-17 Thread Timothy Pratley
`{0~@(cons 0 (take-nth 2 %2))} o_O I tried the `...@v} splice in but never imagined doing that! nice :) On the subject of splice in, am I alone in thinking (str ~...@v) is more readable than (apply str v)? Of course the former doesn't work as there is no preceding syntax- quote, but bear