> Rye is homoiconic, it has no keywords or special forms (everything is a function call, everything is a value) How does it implement and , or , or if ?
This took me a minute to get, even after looking at the page about if : https://ryelang.org/meet_rye/basics/if_either/ The tricky thing about if , and , and or --- the reason you can't implement them as functions in most languages --- is that they need to not evaluate all their arguments immediately. Otherwise: // Would print! if(false, print("oops!")) // Would throw an error if the key is not present and(my_hashmap.…
Rye: Homoiconic dynamic programming language with some new ideas
41–50 of 86 posts
Re: Rye: Homoiconic dynamic programming language with some new ideas
#42Earlier quoted context omitted.
Yes, op and pipe words are the biggest or the most visual addition to Rebol's base idea. Without them if you replace { } with [ ] it's basically just Rebol ... well, with some different details around contexts (rebol's bindology), no refinements, mandatory spacing around tokens, different error handling logic and some other details. I am still learning to explain or even name things, but various examples of using con…
> with some different details around contexts (rebol's bindology) Could you perhaps summarise how contexts work in Rye? On the Ren-C forum we’ve recently been discussing binding a lot, and I’d be interested to learn how Rye does it.
Context is just a namespace of "word: value"-s and an optional link to a parent context. When a word is being searched it looks in the current context and if it's not found it goes up to parent, etc.
One interesting things about contexts are what I called "isolates", a context that is isolated from anything else, but can hold a set of functions specialized for a certain task. Or you can construct and string together custom contexts to create a desired environment for certain code.
When you have a context, you can evaluate code in context, you can call functions in context from outside, you can create functions that are evaluated is a specified context or with a specified parent context, etc ...
You can also move through contexts and list them in Rye console like you would through directories.
I don't know if I answered your question well ... I'm maybe better at showing than explaining. I'm preparing an asciinema demo called "contextplay".
Re: Rye: Homoiconic dynamic programming language with some new ideas
#43Earlier quoted context omitted.
> with some different details around contexts (rebol's bindology) Could you perhaps summarise how contexts work in Rye? On the Ren-C forum we’ve recently been discussing binding a lot, and I’d be interested to learn how Rye does it.
The context in Rye nothing special, but I'm excited about how all it can be used ( and the context details could change a little too in future). Context is just a namespace of "word: value"-s and an optional link to a parent context. When a word is being searched it looks in the current context and if it's not found it goes up to parent, etc. One interesting things about contexts are what I called "isolates", a conte…
Re: Rye: Homoiconic dynamic programming language with some new ideas
#44Earlier quoted context omitted.
The context in Rye nothing special, but I'm excited about how all it can be used ( and the context details could change a little too in future). Context is just a namespace of "word: value"-s and an optional link to a parent context. When a word is being searched it looks in the current context and if it's not found it goes up to parent, etc. One interesting things about contexts are what I called "isolates", a conte…
This sounds almost exactly like how environments work in R, then… is that correct?
One difference with Rebol around scopes is that setwords only set values in current context. A function (or any other context) can't change anything outside directly, and also not in subcontext, so there is not context/word: "value".
You can only call functions in sub or parent contexts.
There are few functions that change words in-place and all end with !, they accept lit-word (in Rebol terms) that they should change in place. So this word is seeked in same manner as in general words are, also through parents, but it's very visible and explicit.
Re: Rye: Homoiconic dynamic programming language with some new ideas
#45Earlier quoted context omitted.
This sounds almost exactly like how environments work in R, then… is that correct?
I've used R for some data visualization in the past, but I'm not sure I was fully aware how R scopes work. The spreadsheet datatype is inspired by dataframes that I first saw in R though. One difference with Rebol around scopes is that setwords only set values in current context. A function (or any other context) can't change anything outside directly, and also not in subcontext, so there is not context/word: "value"…
You might be interested in this description, then: https://adv-r.hadley.nz/environments.html
Re: Rye: Homoiconic dynamic programming language with some new ideas
#46Earlier quoted context omitted.
I've used R for some data visualization in the past, but I'm not sure I was fully aware how R scopes work. The spreadsheet datatype is inspired by dataframes that I first saw in R though. One difference with Rebol around scopes is that setwords only set values in current context. A function (or any other context) can't change anything outside directly, and also not in subcontext, so there is not context/word: "value"…
> I've used R for some data visualization in the past, but I'm not sure I was fully aware how R scopes work. You might be interested in this description, then: https://adv-r.hadley.nz/environments.html
Re: Rye: Homoiconic dynamic programming language with some new ideas
#47Earlier quoted context omitted.
> I've used R for some data visualization in the past, but I'm not sure I was fully aware how R scopes work. You might be interested in this description, then: https://adv-r.hadley.nz/environments.html
I've just skimmed it now but certainly interesting and yes, that namespace and the parent seem just the same. I'm interested in seeing how all they use this. Thank you!
Re: Rye: Homoiconic dynamic programming language with some new ideas
#48Re: Rye: Homoiconic dynamic programming language with some new ideas
#49About getters.. are they foo? or ?foo ? The examples have it mixed, "Meet Rye" doc has it as ?foo
name: Janko ; name: is a set-word - it binds value to a word
?print ; ?print is a get-word - it get's value word is bound to in this case a print builtin function
:age ; left leaning set-word (this is get-word in Rebol)
what? ; just a regular word
...
name get's the value anyway, so we don't need to use ?name but if word is bound to a function just invoking a word will evaluate a function and if we want to return a funtion we use get-word. which has ? in front.? at the end is just a regular word and a (currently accepted) naming convention where noun? means get-noun. so length? in instead of get-length etc.
Rebol used ? at the end convention for more things, a lot for boolean results, testing of types, like string? and positive? but also for lenght?
For booleans current Rye's naming convention is that we use is-adjective. Rebol used positive? to test if value is positive. We would in this way use is-positive.
The conventions might change if we see that there are ways that make more sense and are also consistent.
Re: Rye: Homoiconic dynamic programming language with some new ideas
#50Earlier quoted context omitted.
This is possible with fexprs or equivalent constructs https://en.wikipedia.org/wiki/Fexpr It looks like that's how Rye does it as well, blocks can be conditionally evaluated: https://ryelang.org/meet_rye/basics/if_either/ "In REBOL, contrary to Lisps, blocks or lists don’t evaluate by default. For better or for worse, this little difference is what makes REBOL - REBOL." https://ryelang.org/meet_rye/basics/doing_block…
>programming language based on ideas from Rebol, flavored by Factor, Linux shell and Go That makes it potential interesting to me.