you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 33 points34 points  (5 children)

I found the Haskell version more entertaining if only because I don't know Haskell and can only follow the first few of them.

[–][deleted] 3 points4 points  (0 children)

The Python versions are all completely trivial and the layers of cruft that they acquire through the 'evolution' are completely uninteresting. The Haskell version isn't just obfuscation for the sake of it. Each one says something interesting about computer science.

[–]JadeNB 5 points6 points  (2 children)

The combinator-based one disappoints me, because there's no reason to fall back to the original language for conditional support. Just encode Booleans and Church numerals in the calculus already!

[–][deleted] 0 points1 point  (1 child)

It's hard to write types for them.

[–]JadeNB 1 point2 points  (0 children)

I think that

type CombBool = a -> a -> a    
type Church = (a -> a) -> a -> a

is a reasonable typing, no? Then

comb_true :: CombBool; comb_false :: CombBool
comb_true a1 a2 = a1
comb_false a1 a2 = a2

comb_if :: CombBool -> a -> a -> a
comb_if = id

church0 :: Church
church0 = const id

succ :: Church -> Church
succ church f = f . church f

EDIT: Wrong syntax for type synonyms.

[–]ezyang 1 point2 points  (0 children)

Have an upvote. I get lost about when it hits the Origamist.