Show HN: Lambduck, a Functional Programming Brainfuck

by jorkingiton 6/5/25, 11:29 PMwith 27 comments
by trompon 6/6/25, 8:52 AM

How is a program like

    ``f`,\0`,\0
where f is applied to two arguments, each of which is the next input byte as a Church numeral, evaluated? Does it depend on order of evaluation?

Note that it's also possible to do I/O without additional primitives, as demonstrated in [1].

[1] https://www.ioccc.org/2012/tromp/

by mmoskalon 6/6/25, 1:18 AM

This seems way too readable! I think you should remove the character literals in the name of purity.

Also, this is likely way more compact than Brainfuck, as the lambda calculus is written essentially as usual.

And seriously, very cool!

by 2d8a875f-39a2-4on 6/6/25, 6:38 AM

Shouldn't it be called "Fuckbrain" then?

by 90s_devon 6/6/25, 1:00 AM

This is far too clever for me to even begin to understand.

How do you get the hello world working?

I tried pasting ,--('\< into the code and if it walks like a lamb and quacks like a duck into the stdin field.

by somaton 6/6/25, 1:48 PM

but bf is nothing like c, bf is a stack language, I would say it's closest real language analog is forth.

Anyhow, This is far too clear and straightforward, the bf analog to scheme would probably be unlambda, an implementation of the lambda calculus without lambda forms.

http://www.madore.org/~david/programs/unlambda/

by sphon 6/6/25, 12:05 PM

Genius, great work and well done, though I might not be smart enough to do anything with it.

Please share the interpreter’s code, however bad you feel it is.

Also, definition of de Bruijn index for those of us without formal education: https://en.m.wikipedia.org/wiki/De_Bruijn_index

by reuben364on 6/6/25, 3:02 PM

Since the de Bruijn indices are limited (and presumably still Turing complete), I wonder how limited you can make them and still be Turing complete.

by naikrovekon 6/6/25, 11:33 AM

I’m too stupid to even recognize how esoteric this is.

by reverendsteveiion 6/6/25, 2:03 PM

from the least cute name for a programming language instantly to the most cute name for a programming language. Let's go LambDuck!

by jzemeocalaon 6/6/25, 1:13 AM

Do Malborge next