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
examp
On Wed, Dec 17, 2008 at 6:15 PM, 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
&
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 app
On Dec 17, 8:09 pm, Chouser 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 can't figu
This shaves 14 characters off of Chouser's solution:
(defn enc[s e](apply str(map(apply hash-map(take-nth 2 e))s)))
rzezeski: The problem statement is somewhat ambiguous about what to
do if the character is missing from the mapping. It says you can just
"skip it", and this short solution does
On Dec 17, 9:53 pm, "Mark Engelberg" 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)))
>
> rzezeski: The problem statement is somewhat ambiguous about what to
> do if the character is missing from the mapping. It sa
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.
--~--~-~--~~~---~-
On Wed, Dec 17, 2008 at 9:53 PM, Mark Engelberg
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 message because you are
On Wed, Dec 17, 2008 at 9:53 PM, Mark Engelberg
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)))
Which leads me to this, though it fails for reasons that escape me:
(defn enc[s e](apply str(map`{~@(take-nth 2 e)}s))
>>`{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 bea
Hello,
On Dec 18, 5:49 am, Chouser wrote:
> Which leads me to this, though it fails for reasons that escape me:
> (defn enc[s e](apply str(map`{~@(take-nth 2 e)}s)))
This one maybe fails because ~@ is a reader form that needs to expand
at compile time.
So if at compile time, e is not known (e.g
11 matches
Mail list logo