Jon Purdy
2014-05-05 21:19:51 UTC
I would like to use () instead of [].
Syntax design is hard. The argument for [] is that theyâre non-shiftkeys (on US keyboards) and they free up parentheses for their more
common meanings of grouping (mathematics) or comments (natural
language). I use {} for code quotations in Kitten because they give
you a syntax more resembling C, and that frees up [] for data
quotations (vectors).
Factor, with its 224MB-installation seems a lot more than i can chew.
I agree. :)() (1 2 3) uncons (swons)dip
() (1 2 3) uncons swons^
We talked about this briefly on the Concatenative Programming G+() (1 2 3) uncons swons^
group[1], namely that higher-order functions are something like
adverbs, and seem to work well when they look syntactically like
inflections. You could make the combination of word+symbol invoke
â(word) symbolâ and avoid a lot of nesting without making â^â special.
[1]: https://plus.google.com/103392068634106050064/posts/gEkDANFd7qp
(name)
`name
This is a small difference. The improvement is not in typing but in reading: `name is most of the time a name, passed to a function.
I read those differently:`name
This is a small difference. The improvement is not in typing but in reading: `name is most of the time a name, passed to a function.
(name) = âpush a new quotation which calls ânameââ
`name = âpush the word ânameâ itselfâ
Of course, they can have the same implementation.
fac-2 doesn't work! Because copy+paste didn't change the name fac-1 into fac-2.
fac-1: ( 0 = )( zap 1 )( dup 1 - fac-1 * )if*
fac-2: dup 0 = ( zap 1 )( dup 1 - fac-1 * )if/
In the following 'loop' is just a symbol, that is going to be replaced by the name of the currently defined word. This saves typing and is an improvement on legibility.
fac-1: ( 0 = )( zap 1 )( dup 1 - loop * )if*
fac-2: dup 0 = ( zap 1 )( dup 1 - loop * )if/
Forth implementations sometimes have a ârecurseâ word for thisfac-1: ( 0 = )( zap 1 )( dup 1 - fac-1 * )if*
fac-2: dup 0 = ( zap 1 )( dup 1 - fac-1 * )if/
In the following 'loop' is just a symbol, that is going to be replaced by the name of the currently defined word. This saves typing and is an improvement on legibility.
fac-1: ( 0 = )( zap 1 )( dup 1 - loop * )if*
fac-2: dup 0 = ( zap 1 )( dup 1 - loop * )if/
purpose. I prefer ârecurâ or âloopâ because it lets you say cute
things like:
def repl: read evaluate print loop
I think there are lots of running implemetations of pure Joy somewhere in the internet, but the only ones i know about are Joy1 in scheme and C form John Cowan, njoy in OCaml from Christian Szegedy and Conca from Claude Marinier.
Do you want this to become the standard implementation of Joy? Joyseems like the concatenative Scheme, in that itâs small and easy to
implement, so there are many incompatible implementationsâŠ
I don't know, is it a coincidence or did it just happen at the same time that Claude and i present the same idea within a few days.
That has a tendency to happen.The code is at sourceforge at Rabbit-vm.
You should check it into the repo on SourceForge so that it can bebrowsed under âCodeâ instead of by downloading the tarball. :)