Skip to content

Instantly share code, notes, and snippets.

@ELLIOTTCABLE
Created December 16, 2016 02:14
Show Gist options
  • Save ELLIOTTCABLE/1ca70f2ed54659b1e7c2164ffbbeffb1 to your computer and use it in GitHub Desktop.
Save ELLIOTTCABLE/1ca70f2ed54659b1e7c2164ffbbeffb1 to your computer and use it in GitHub Desktop.
; Reference implementation of Iota. See http://ling.ucsd.edu/~barker/Iota
; Usage: echo -n "**ii*ii" | guile -l iota.scm
(let iota ()
(if (eq? #\* (read-char)) ((iota)(iota))
(lambda (c) ((c (lambda (x) (lambda (y) (lambda (z) ((x z)(y z))))))
(lambda (x) (lambda (y) x))))))
; I = *ii
; K = *i*i*ii
; S = *i*i*i*ii
; infinite loop: ```sii``sii = ****i*i*i*ii*ii*ii***i*i*i*ii*ii*ii
; diverging infinite loop: ```s`sk`sk``sii =
; ****i*i*i*ii**i*i*i*ii*i*i*ii**i*i*i*ii*i*i*ii***i*i*i*ii*ii*ii
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment