Live data from Hacker News

Show HN: Lambduck, a Functional Programming Brainfuck

imjakingit.github.io

11–20 of 29 posts

Re: Show HN: Lambduck, a Functional Programming Brainfuck

#11

Earlier quoted context omitted.

getchar does take a continuation of sorts (as in continuation passing) which is passed the input. In one my initial drafts, getchar was a special form that would accept input at the point of evaluation, which was really funny and unpredictable. putchar I feel kind of weird about, it acting as an identity function with a side effect is kind of weird; I'm not sure changing it to take a second argument as a continuation…

Entirely agreed that it's nothing but more noise, but isn't that exactly how BF is? Why ----- instead of 5-? Well, because BF of course. The point of the exercise (IMO) is having the bare minimum in parsed characters to achieve the turing tarpit. 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 la…

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

#12

Earlier quoted context omitted.

Entirely agreed that it's nothing but more noise, but isn't that exactly how BF is? Why ----- instead of 5-? Well, because BF of course. The point of the exercise (IMO) is having the bare minimum in parsed characters to achieve the turing tarpit. 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 la…

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!

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

#14

Earlier quoted context omitted.

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!

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.

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

#15

Earlier quoted context omitted.

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.

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.

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.

Re: Show HN: Lambduck, a Functional Programming Brainfuck

#17
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/

Re: Show HN: Lambduck, a Functional Programming Brainfuck

#18
post #17

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/

I saw this the other day! I salute you, it's so much more evil :-)

And yup, the order of evaluation is leftmost innermost.

  ``\\0`,.`,.
with stdin "hi" will print "hi".

Re: Show HN: Lambduck, a Functional Programming Brainfuck

#20
post #4

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!

So here’s my question: is the interpreter more or less compact than a brainfuck interpreter? Which interpreter would have a lower Kolmogorov complexity, or could they be equivalent?
Post reply on HN