Discussion:
Rabbit-vm
Jon Purdy
2014-05-05 21:19:51 UTC
Permalink
I would like to use () instead of [].
Syntax design is hard. The argument for [] is that they’re non-shift
keys (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+
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) = “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 this
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? Joy
seems 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 be
browsed under “Code” instead of by downloading the tarball. :)
h***@yahoo.de
2014-05-06 20:33:14 UTC
Permalink
Hi Jon,

thank you for your feedback.


() or []

In my opinion () is a little better to read than [].
((())) [[[]]] not much, just a little.

My app translates BEGIN begin [ ( ) ] end END to ( ( ( ( ) ) ) )
These four types of braces can be used interchangeable as long
as they match.
Post by Jon Purdy
() (1 2 3) uncons (swons)dip
() (1 2 3) uncons swons^
We talked about this briefly on the Concatenative Programming G+
group[1], namely that higher-order functions are something like
adverbs, and seem to work well when they look syntactically like
inflections.
dip is the most commonly used word in Joy code i have written so far.
I don't know, if this is because of my way of coding.
Post by Jon Purdy
You could make the combination of word+symbol invoke
“(word) symbol” and avoid a lot of nesting without making “^” special.
I'm not sure about this. Currently i have
`name -> (name)
,name -> (name)first
@name -> get definition of name
!name -> set definition of name
Post by Jon Purdy
name -> push TOS to name
<name -> pop from name and push to stack
~apply at name

For instance the following programm

`name {} () define
1 >name 2 >name 3 >name 4 >name
(swap)~name
@name

should push (3 4 2 1) to stack.

But i don't use it!
Instead i can't use >name just as name for a word.

I like
,name^^
as abbreviation for
((name)first)dip2

Currently this sugar is in the parser. Maybe i try to make primitives from it.
Post by Jon Purdy
Forth implementations sometimes have a “recurse” word for this
purpose. I prefer “recur” or “loop” because it lets you say cute
def repl: read evaluate print loop
I didn't know this. Thank you.

Loading...