Y (K M) = M
Aug. 10th, 2014 10:12 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Encoding ω Α (K ω), where ω ≡ λx.x x, A ≡ λx.λf.f (x x f), and K ≡ λx.λy.x:
$ cat init.txt term = \read_{strdup("")}(\print); term = \apply(\apply(omega1, a), \apply(k, omega2)); omega1 = \lambda(x1, \apply(\amb(y1, \share(x1, z1), z1), y1)); omega2 = \lambda(x2, \apply(\amb(y2, \share(x2, z2), z2), y2)); a = \lambda(self, \lambda(func, \apply(func1, rec))); rec = \apply(\apply(self1, self2), func2); self1 = \amb(self2, \share(self, back1), back1); func1 = \amb(func2, \share(func, back2), back2); k = \lambda(x, \lambda(\erase, x)); $ make printf '%s\n\n$$\n\n%s\n\n$$\n\n%s\n' >test.in \ "`cat rset.txt`" \ "`cat init.txt`" \ "`cat tail.txt`" inc <test.in mv in.tab.c test.c cc -o test test.c valgrind ./test ==20346== Memcheck, a memory error detector ==20346== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==20346== Command: ./test ==20346== v1: (v1 (v1)) ==20346== ==20346== HEAP SUMMARY: ==20346== in use at exit: 0 bytes in 0 blocks ==20346== total heap usage: 606 allocs, 606 frees, 23,934 bytes allocated ==20346== ==20346== All heap blocks were freed -- no leaks are possible ==20346== ==20346== For counts of detected and suppressed errors, rerun with: -v ==20346== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4) $