Email or username:

Password:

Forgot your password?
Devil Lu Linvega

I spoke too soon earlier, it turns out that forth-style lambdas are possible by adding only 31 bytes to the self-hosted assembler. It might be worth it, it adds a lot of expressiveness by allowing to play with a lot of joy-like things.

21 comments
Max Cahill

@neauoire can I get a breakdown of what's going on here?

Devil Lu Linvega

@maxc Are you familiar with Joy? Thoses curlies denote lambdas, they're made a bit like a cons cell, there's a CDR-like address at the start, their pointer ends up on the stack so they can be unquoted, moved around, or called.

Max Cahill

@neauoire only as a kind of happiness and I guess as a family of nurses 😉 will look into it thanks

I think ultimately for lambda/anonymous function stuff it's always all about convenience/laziness so as long as it's shorter and easier to write than making another function and copying the label for that elsewhere, there's a chance it's considered useful!

Devil Lu Linvega

@maxc Uxntal is already tacit PF, so not only you don't need to write parameter names in a function, you can now be even more lazy and skip naming it altogether. Here's a nice little primer to Joy.
wiki.xxiivv.com/docs/joy_combi

Max Cahill

@neauoire for those following along I basically found hypercubed.github.io/joy/html/ and it was very readable. Haven't dug into devine's resources yet :)

efelbar

@maxc @neauoire the tutorial (hypercubed.github.io/joy/html/) also seems helpful! this is a very interesting rabbit hole :>

Devil Lu Linvega

@johnfredcee I mispoke, implemented how forth handles strings, but using that strategy more broadly to allow lambdas.

Devil Lu Linvega

@nil I kindda wanna try implementing all the combinatory birds now

DELETED

@neauoire smullyan’s aviary if you will. Also is the code you are working on visible online somewhere?

max22-

@neauoire looks cool ! often I can't read uxntal code, but I immediately understood this one. where do you store the code of the lambda ? you just push the address of the first instruction after the first "{" ?

Devil Lu Linvega

@maxime_andre I went for a JMI -> STH2r, so I jump-stash over the lambda, and then move the pointer to the wst from the rst. It's nicer that way I found.

max22-

@neauoire ok i think i understand. (it took me some time ^^). When you say jump stash, you mean JSR2 ? (i don't know why, i've always thought that JSR meant "jump subroutine"...)

Devil Lu Linvega

@maxime_andre I'm not really sure which one is right, I've always called it Jumpstash for some reason ^^:

Nico Nico Belić

@neauoire you're making me come back to Factor and Joy :)

and try uxntal + varvara but that's for another day... maybe a port of Joy?

Devil Lu Linvega

@a13cui This morning I'm implementing some of Joy's combinators, I think you could write straight joy, directly in uxntal now.

Devil Lu Linvega

Instead of an absolute address(a-la cdr) to the end of the lambda scope, I'm piggy-backing on the JSI opcode which stores a relative address, so this gives me the length of the lambda scope, and as a side effect, "free" Pascal-style strings. I've totally lost track of where I was going with this lambda project, but I LOVE IT

Devil Lu Linvega

These 12 lines are the whole of the lambda implementation, written in itself.

Annette

@neauoire I had to stare at this for quite a while and reread the prior toot more than once before I understood and this is delightful!

Go Up