Re:Show HN: Lambduck, a Functional Programming Brainfuck
by jorkingit on Friday June 06, 2025 @01:01AM
(#44197941)
You can always write it in continuation-passing style if you really want continuations! It's not pleasant but none of this is supposed to be ;-)
Agreed on having too many characters though, I don't like that having numerical indices makes the syntax whitespace-sensitive, too.
And once I figure out how to write hello world, those character literals are gone!
Re:Show HN: Lambduck, a Functional Programming Brainfuck
by fc417fc802 on Friday June 06, 2025 @02:03AM
(#44198182)
Maybe my brain just isn't functioning right now but I don't think writing in CPS is the same as having access to first class continuations? But as previously noted I think that was a misplaced request on my part to begin with.
Re:Show HN: Lambduck, a Functional Programming Brainfuck
by jorkingit on Friday June 06, 2025 @02:58AM
(#44198424)
It should be! e.g. if every function takes a continuation as its final argument, then:
call/cc& = \f. \k. f k k
Then in f you can invoke the continuation k as many times as you want, but that does involve a whole program transformation to CPS.
Re:Show HN: Lambduck, a Functional Programming Brainfuck
by fc417fc802 on Friday June 06, 2025 @03:57AM
(#44198720)
My line of thought had been that doing so doesn't restore execution context. But it dawns on me that without the ability to mutate variables that doesn't have the same relevance.
Still, doesn't it throw the de bruijn indexes off? Or am I wrong about that as well?
Lambda calculus makes my head hurt.
I quite like the movable register idea but as you say that's no longer a "BF except lambda calculus" it's some other esolang at that point.
I think my objection about the lack of continuations was misplaced given that appears to be a BF take on the lambda calculus rather than a BF take on scheme.