10 ms·
>Does it implement 'readable' Nope, it has it's own notation which I find very close to the Smalltalk one, for example: red>> a: [1] == [1] red>> pick h
by mapcars 10y ago
>Does it implement 'readable'
Nope, it has it's own notation which I find very close to the Smalltalk one, for example:
red>> a: [1]
== [1]
red>> pick head append a 1 + 1 2
== 2
red>> a
== [1 2]
So the second expression is good example of how things work, this is how it looks if I put parens (which are unnecessary in this case):
pick (head (append a (1 + 1))) 2
Here interpreter/compiler knows how many arguments each `word` (you can think `function`) needs, so `append` needs 2 - series and item to append, `head` only one - series, `pick` needs series and index to get element. But what about `+`?
red>> type? :+
== op!
Operators are infix things of two arguments and they get priority over function calls, that's why `append` is called with `a` and result of `1 + 1` and not with `a` and `1`.
It looks a bit tricky in the beginning, I understand, but it leads to very compact and easy to read code.
This is brief explanation which should help you to start reading and writing Red/Rebol code :)
- allover 10y agoGreat explanation, thanks!