Skip to content

Instantly share code, notes, and snippets.

View akkartik's full-sized avatar

Kartik Agaram akkartik

View GitHub Profile
@timyates
timyates / fact.groovy
Created March 6, 2013 14:16
Y combinator factorial in Groovy
fact_improver = { partial ->
{ BigInteger n ->
n == 0 ? 1 : n * partial( n - 1 )
}
}
y = { improver ->
{ gen -> { BigInteger n -> improver( gen( gen ) )( n ) } } { gen ->
{ BigInteger n -> improver( gen( gen ) )( n ) } }
}