4 ms·
You can in fact define a fixed point combinator in good old C99, one that compiles without warning, and doesn't take all that much code. From http://www.ioccc.
by tromp 12y ago
You can in fact define a fixed point combinator in good old C99, one that compiles without warning, and doesn't take all that much code.
From http://www.ioccc.org/2014/whowon.html http://www.ioccc.org/2014/whowon.html
Most functional
Freek Wiedijk - Y combinator
We'll have to patiently await publication of the source though...
- readerrrr 12y agoDo you have any code examples?
- amelius 12y agoThe Y combinator causes problems with typing (it has an infinite recursive type), so I'm curious what solution they came up with. In any case, if calling a lambda function from within itself is going to take more than a single line of straightforward code, then I'm afraid the solution still doesn't cut it for practical purposes.
- anaphor 12y agoThey could've done something similar to what you do when you implement a functional language in C and used a union to represent every possible return type, and included functions (closures if you will) in that union, then you solve the problem of the infinite type.
- jjaredsimpson 12y agowhy does this matter, what is the overwhelming use case for self referential anonymous functions.
- userbinator 12y agoso I'm curious what solution they came up with. I'm guessing a cast. The infinitely long type is not at all a problem in languages with weak type systems like C.