Haskell, score 61 (=
), 56 characters
Characters used: !#$%&()=
The SKI combinator calculus can be implemented in Haskell with nothing but basic function definition, using !#%&
as identifiers. Infix function application $
is used to save on parentheses and strip down one character from both S
and fix
. Finally, K
only takes two arguments and can be more shortly defined as an infix operator.
S
combinator: s x y z = x z (y z)
(!)(#)(%)(&)=(#)(&)$(%)(&)
K
combinator: k x y = x
(!)#($)=(!)
fix
combinator: fix f = f (fix f)
(&)(!)=(!)$(&)(!)
Since Haskell is a strongly typed language, the fixed-point combinator fix
is needed in order to make (typed) combinatory logic Turing-complete.
The I
combinator is not strictly required since it is extensionally equivalent to SKK
, but it can be defined as (*)(!)=(!)
.