![]() ![]() To guarantee that for all terms which have a normal form, that normal form is actually found, a lazy evaluation order has to be employed. It turns out however that some care has to be taken regarding the order of evaluation. ThenĮncoding the SKI combinator calculus in Scala’s type system seems not too difficult at first. However since the SKI calculus is Turing complete, I take this for granted.) Now let be in from above (That is we have now). ![]() (There is a bit of cheating here: I should actually show that such combinators exist. That is, combinator is the combinator obtained by applying its argument to the combinator. Let be the reversal combinator from above. Self application is used to find fixed points. They can be used to encode arbitrary calculations. The SKI combinators are defined as follows: Looking for a calculus which is relatively small, easily encoded in Scala’s type system and known to be Turing complete I came across the SKI combinator calculus. Motivated by the blog post More Scala Typehackery which shows how to encode a version of the Lambda calculus which is limited to abstraction over a single variable in Scala’s type system I set out to further explore the topic. Various of my older posts show how Scala’s type system can be used to encode addition and multiplication on natural numbers and how to encode conditions and bounded loops. The question is whether Scala’s type system can be used to force the Scala compiler to carry out any calculation which a Turing machine is capable of. In one of my posts on type level meta programming in Scala the question of Turing completeness came up already.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |