Great work — the functional spin on top of Rebol's clean syntax is really nicely done!
Any chance you'll be adding something like the parse function? The ability to have domain-specific dialects was one of the best things about Rebol and would be great to see in a modern language.
And speaking of functions, could you make the "Function Reference" that's on the homepage, be available on a standalone page too? It's a very useful reference and would be great to access it easily. Thanks!
Regarding 'parse', it's absolutely in my to-do list. Although, already, the language by its very nature has the means to do it (even you, as a user, could) - but I have to prioritize things.
Yes, Red is another fine language. However, to be fair, I would say Red is practically like Rebol v3. Arturo's goal is not to become yet another Rebol, but combine its positive aspects (which are a lot) with other features of modern programming languages, mostly functional programming -oriented. Actually, Arturo's influences range from Rebol to Ruby, Haskell, Tcl and even Forth or Factor or... Swift.
In any case, I'm all ears for feedback/ideas/suggestions. Code contributions are more than welcome as well - it's been just a one-guy thing so far, and I can honestly not find time for everything :)
Describing Red as Rebol3 like is not fair IMO, it goes beyond that in many aspects - there is a compiler, C-level dialect (Red/System), reactive framework, ...
Anyway, Arturo looks interesting and I'm looking forward to try it!
I didn't say that in a despective way at all. My only point is that Red - as far I've seen it at least - tries to maintain a great deal of compatibility with Rebol, while Arturo used it as a starting point. (Arturo can be run as valid Rebol code, only if you stick to the absolute basics)
Even using it as an inspiration, it's obvious that I absolutely respect both projects.
Again, what I'm trying to do is take the good points and create something completely new.
Looking forward to hearing your feedback/ideas/suggestion/anything. I'm all ears! :)
I was following Red with keen interest, waiting for them to add Postgres support.
Unfortunately this never happened, I think they got sidetracked by over-enthusiasm for crypto tools and thus lost momentum.
I've watching/studying Red for a long time. And it is a very legitimate effort to be honest. However, when trying to do too much at the same time (and attempting to build a full-stack, do-it-all language would surely qualify for that), you can easily get sidetracked.
My attempt here is nothing too bloated. I just needed a super-flexible, easy to use (and tweak) programming language for me (automation, templates, typesetting, "quick" scripts and webview-based app publishing). So, I created it.
It's by no means "complete" - yet. Although, after months (to years) of hard work, I think it's ready to get a bit more known. At least, my personal goal has been achieved: Arturo is the language I personally use for my everyday scripting. :)
Red got sidetracked by an attempt to build local economy based on an ERC-20 token, to be precise: for tipping contributors, funding FOSS projects and helping maintainers, curating high-quality learning materials within community, etc. That didn't pan out in the near term since no-one shared the enthusiasm.
Besides, there are only a few active contributors helping the project, others, unfortunately, prefer to watch from afar and wait, or to pick Red apart feature-by-feature for other languages — and TBH I don't know if this is a historical problem with Rebol family or lack of goal-oriented communication from Red's side which would encourage people to participate (e.g. write a Postgres driver).
I had interest in Rebol and Red, but lost it. Lost the interest because of what you mention, but also because building algorithms with it imply a big cognitive load for me.
Since then, I'm very happy with TCL, one of the inspirations for Rebol. Its syntax is regular, it's a professional tool, conservative, i.e. doesn't break code at each new release, has great GUI with Tk, and many other advantages.
Postgresql needs full IO support which is coming in 0.7.0, next major release. There is development branch with IO so if someone's interested, writing PostgreSQL driver should be possible today.
I can't find any reference for what the arrow is doing. It looks like a lambda in the first part (x -> print [x "is even"]), except that would mean that's getting passed to "even?" instead of "x". But that doesn't make sense for the second one, so is the arrow part of "if?"/"else" or is it an alternate way of wrapping the print in a block? Or something else?
Well, it's obviously not your fault - I should have explained it better in the Language Reference (but it's a work-in-progress and I definitely will explain it thoroughly).
So...
The command "if?" takes two arguments: a boolean and a block.
Think of it like if? <something> [do something-else].
In this example, something is `even? x` and something-else is `print [x "is even"]`.
And yes, regarding the right-arrow symbol you are absolutely correct: it's syntactic sugar for wrapping a command in a block (provided that it's just ONE command - if there are more than one, you will have to use a block).
But it's still syntactic sugar as ALL symbols being used in Arturo. Pretty much like ".." is the symbol infix-alias of the command "range".
Oh, I've used rebol 2 since like 1999 or 2000, so I got most of it, and the ".." was fairly guessable (also I've used it in bash), it's just the arrow that had me confused.
Was also going to note the "?" in "if?" didn't make sense, due to how it's used in rebol, before finding core has both "if" and "if?", and "if?" does indeed return a boolean. Since both are there though, that does make it unnecessary in this particular example.
However, there is one thing that could be done with "if": in arturo, it's documented to always return null, however in rebol it returns the value of the evaluated block, making "if/else" and "either" work as a ternary (and just "if" returns a none! if it was false).
Basically, the idea behind "?" is "functions that return a boolean". But done in a consistent way. So, practically EVERY function that returns a boolean is - by convention - terminated with a "?".
Now, why the two "if"s:
Obviously, as you yourself mentioned, 'if? returns a boolean (the result of the condition) and 'if doesn't.
So that's one use.
The next use - which I will obviously have to make crystal clear in the Language Reference - is that if? (with the ?) is a must if you want to pair with an "else".
Think of it this way. If?-else may appear as a language construct, but in fact they are two separate commands. The if? is an if - that pushes the result of the condition of the stack. And "else" is actually a reversed-if: it checks what is at the top of the stack (see: returned by the if? above) and if that is false - that is: the above if-condition was not true - it executes its block.
So, in that case, you have to use an "if?" (and not a simple "if")
The same thing happens with a case/when? construct (only, in that case, the condition blocks are actually concatenated),e .g.
case [x]
when? [<3] [print "it was less than 3"]
when? [=3] [print "it was equal to 3"]
else [ print "it was greater than 3"]
Regarding if returning a value - and thus, being able to use it as part of an expression - is an absolutely interesting idea I've been thinking of implementing. However, I still don't know how.
One idea would be to add an .attribute, e.g. if.get - and then have it return a value.
Or, use a different function altogether.
But then we'd have, 3-4 if's. That sounds like a bit of an overkill, I admit.
Looks great! Just one question: in the roadmap, what do you mean by "Implement LaTeX generation module"? You want to make a templating system like Sweave in R [0]?
Well, the details remain to be finalized but the general idea is a generator DSL. Think of HAML in regards to HTML for example: you can write nice DSL-specific code that gets translated into valid HTML code. (There is already a relevant module for that for Arturo, thought at a very experimental level: https://github.com/arturo-lang/art-html-module).
I'm thinking of the same thing for LaTeX (and perhaps even more sophisticated). One of my main "businesses" is centered around typesetting and electronic publishing, hence I'm a heavy ... LaTeX user.
Feel free to ask anything else. All suggestions and contributions are welcome! :)
thanks a lot for your kind words. Arturo is a love child of mine and a project I've been working on in the past many years.
Rebol has absolutely been an inspiration. But I'm just trying a different take on it - a bit more flexible, more dynamic and with more modern programming language features.
Any idea/comment/suggestion or even code contribution is more than welcome! :)
Which is in fact Logo's syntax. I don't see any literal forms for IP addresses, URLs, e-mails, dates, @references and hashtags in Arturo, which are historically present in Rebol and which make it unique.
No, Arturo has a wide range of built-in datatypes but no literal forms of IP addresses or URLs or e-mails or so.
And that was a conscious choice. Having different forms of declaring literals, in my eyes simply "litters" the language.
What Arturo does instead is use simple strings... And the interpreter internally tries to make out what they are automatically.
For example: the 'do' function can take pretty much anything. If it is a block, it executes it. If it is a string, it executes it too - but depending on what it is. If it is a url, it executes the remote script. If it's a local file, it executes the file. If it's Arturo code, it executes it as Arturo code.
The interpreter identifies what it is automatically. Why have different data types for that, pre-built in the language?
I see, so strings act as implicit "constructors" for datatypes (which are not even datatypes per se, just encoded information within a given string datatype), depending on their usage? This is indeed an interesting design choice. Rebol in such cases requires explicit conversion from string to a target type.
Well, the main difference is that - although we do use strings (for files, urls, etc) - the appropriate datatypes are constructed implicitly, that is: no need for newFile("someFile") or %someFile. "someFile", if it is a file path, will be automatically handled as such. If it is a url, accordingly.
The point is to keep the syntax clean. (Ok, that would be an argument of going all the way, like Tcl, where everything ends up being a string - but let's just get the best of every world without overdoing it :) )
(I'm replying here, since I don't seem to be able to reply directly)
@9214 Since you are knowledgeable about the topic (included but not limited to Rebol/Red), I would be glad if you joined the effort. Even testing bits here and there would be great. You're welcome :)
Alright, but personally I fail to see how is that qualitatively different from all the other mainstream languages that use strings as a compensatory kitchen sink to encode literals not present by default.
Well, you have a point here: even? (and odd?) is somehow missing from the (auto-)generate docs at the wiki. I'll fix it asap. Thanks for letting me know.
Regarding the syntax:
every "function" in Arturo takes a specific number of arguments. in that case: loop, if?, even? else are ALL functions (there are no special constructs in Arturo, nor reserved keywords).
Regarding your second example/question: you could have written it like that, but it wouldn't do as you expect.
What can be done though is using the 'case function.
Hmm... I had no idea. Thanks a lot for the suggestion :)
P.S. A little bit of trivia: my choice of the scorpion logo was no random selection at all. Arturo was my little (well, not so little) Black Emperor scorpion that passed away in February. Hence, the name. And the logo...
The scorpion logo is fine and matches the gist of the project: Nim and Rebol are somewhat exotic but really powerful if you can tame them. My subjective 2 cents..
Rebol - Arturo's ideological grandparent - is a great language (albeit not as well-known as it should be). And Arturo attempts to get the best bits of it and make a modern take on programming.
In the website (and the GitHub repo) you will find more than enough information about it.
Easy-of-use, flexibility, blocks and dialecting, no-reserved-keywords approach, wide range of datatypes, homoiconicity - to name a few.
That being said, as I've already mentioned, my goal was not to make a Rebol replica. Arturo is a new language.
Now, regarding the "inspiration" part, to anyone that is familiar with Rebol, I think it would be fair to say that Arturo does look more like the Rebol group, than an Algol-type language, or ML, or Python type of language. I don't know... (I would really be intrigued to hear what it reminds you of... :))
My 2 cents: please add an example or two for dialecting and homoiconicity, because that's IMO not apparent from what I've seen so far (granted, I could have missed some bits), and the terms "dialecting" and esp. "homoiconicity" are so ill-defined that everyone uses them to describe different things.
My understanding so far is that Arturo has VM-based interpreter (perhaps stack-based or even indirect-threaded, hence the mention of Forth as an inspiration) which operates on a syntax tree (either concrete or abstract, although Rebol uses the former) produced from textual source during lexing. Is that correct?
I want that too - I mean to elaborate more on these aspects with real-use examples, but I guess I'm putting it off until I deal with other small issues.
Regarding "homoiconicity", the way I would succintly put it is that: the line between what is considered code and what is data is super-fine. Basically, anything can be anything - depending on the context. Thus, an Arturo script can manipulate its own code, the way it can manipulate any other type of data.
Regarding Arturo's implementation: It's written in Nim (though I have written it in the past in almost every language you can think of... lol started with C++, went to D, then to Nim, back to C, and now in Nim again). Basically it's a Stack-based Bytecode Virtual Machine. And yes, Forth's influence is also important - although (intentionally) not that obvious at first sight.
The source text is parsed to an abstract structure/tree of words and symbols. That's the part that happens in translator/parse.
Then if it's an executable block, it is evaluated (as valid Arturo code) into Bytecode (this happens in translator/eval), and then this bytecode is executed by the virtual machine (in vm/exec).
Any chance you'll be adding something like the parse function? The ability to have domain-specific dialects was one of the best things about Rebol and would be great to see in a modern language.
And speaking of functions, could you make the "Function Reference" that's on the homepage, be available on a standalone page too? It's a very useful reference and would be great to access it easily. Thanks!
Regarding 'parse', it's absolutely in my to-do list. Although, already, the language by its very nature has the means to do it (even you, as a user, could) - but I have to prioritize things.
Regarding reference, it's obviously a work-in-progress. However, what you mean is probably already available @ GitHub Wiki: https://github.com/arturo-lang/arturo/wiki
Have a look :)
Looking forward to hearing your feedback. Anything is welcome, ideas or suggestions :)
Let me know what you think! :)
Another REBOL-inspired language is Red [0], which also looks interesting.
Maybe I'll actually sit down and have a proper look one of these days.
0: https://www.red-lang.org/
In any case, I'm all ears for feedback/ideas/suggestions. Code contributions are more than welcome as well - it's been just a one-guy thing so far, and I can honestly not find time for everything :)
Anyway, Arturo looks interesting and I'm looking forward to try it!
Even using it as an inspiration, it's obvious that I absolutely respect both projects.
Again, what I'm trying to do is take the good points and create something completely new.
Looking forward to hearing your feedback/ideas/suggestion/anything. I'm all ears! :)
(Code contributions are also 100% welcome!)
My attempt here is nothing too bloated. I just needed a super-flexible, easy to use (and tweak) programming language for me (automation, templates, typesetting, "quick" scripts and webview-based app publishing). So, I created it.
It's by no means "complete" - yet. Although, after months (to years) of hard work, I think it's ready to get a bit more known. At least, my personal goal has been achieved: Arturo is the language I personally use for my everyday scripting. :)
Besides, there are only a few active contributors helping the project, others, unfortunately, prefer to watch from afar and wait, or to pick Red apart feature-by-feature for other languages — and TBH I don't know if this is a historical problem with Rebol family or lack of goal-oriented communication from Red's side which would encourage people to participate (e.g. write a Postgres driver).
So...
The command "if?" takes two arguments: a boolean and a block.
Think of it like if? <something> [do something-else].
In this example, something is `even? x` and something-else is `print [x "is even"]`.
And yes, regarding the right-arrow symbol you are absolutely correct: it's syntactic sugar for wrapping a command in a block (provided that it's just ONE command - if there are more than one, you will have to use a block).
But it's still syntactic sugar as ALL symbols being used in Arturo. Pretty much like ".." is the symbol infix-alias of the command "range".
Was also going to note the "?" in "if?" didn't make sense, due to how it's used in rebol, before finding core has both "if" and "if?", and "if?" does indeed return a boolean. Since both are there though, that does make it unnecessary in this particular example.
However, there is one thing that could be done with "if": in arturo, it's documented to always return null, however in rebol it returns the value of the evaluated block, making "if/else" and "either" work as a ternary (and just "if" returns a none! if it was false).
Now, why the two "if"s:
Obviously, as you yourself mentioned, 'if? returns a boolean (the result of the condition) and 'if doesn't.
So that's one use.
The next use - which I will obviously have to make crystal clear in the Language Reference - is that if? (with the ?) is a must if you want to pair with an "else".
Think of it this way. If?-else may appear as a language construct, but in fact they are two separate commands. The if? is an if - that pushes the result of the condition of the stack. And "else" is actually a reversed-if: it checks what is at the top of the stack (see: returned by the if? above) and if that is false - that is: the above if-condition was not true - it executes its block.
So, in that case, you have to use an "if?" (and not a simple "if")
The same thing happens with a case/when? construct (only, in that case, the condition blocks are actually concatenated),e .g.
case [x] when? [<3] [print "it was less than 3"] when? [=3] [print "it was equal to 3"] else [ print "it was greater than 3"]
:)
:)
One idea would be to add an .attribute, e.g. if.get - and then have it return a value.
Or, use a different function altogether.
But then we'd have, 3-4 if's. That sounds like a bit of an overkill, I admit.
I'm absolutely open to ideas :)
Let me know what you think! :)
[0] https://stat.ethz.ch/R-manual/R-devel/library/utils/doc/Swea... I haven't used it in a while, so it's the best explanation link I could find.
I'm thinking of the same thing for LaTeX (and perhaps even more sophisticated). One of my main "businesses" is centered around typesetting and electronic publishing, hence I'm a heavy ... LaTeX user.
Feel free to ask anything else. All suggestions and contributions are welcome! :)
Let me know what you think! :)
Rebol has absolutely been an inspiration. But I'm just trying a different take on it - a bit more flexible, more dynamic and with more modern programming language features.
Any idea/comment/suggestion or even code contribution is more than welcome! :)
Let me know what you think! :)
And that was a conscious choice. Having different forms of declaring literals, in my eyes simply "litters" the language.
What Arturo does instead is use simple strings... And the interpreter internally tries to make out what they are automatically.
For example: the 'do' function can take pretty much anything. If it is a block, it executes it. If it is a string, it executes it too - but depending on what it is. If it is a url, it executes the remote script. If it's a local file, it executes the file. If it's Arturo code, it executes it as Arturo code.
The interpreter identifies what it is automatically. Why have different data types for that, pre-built in the language?
And this is the way it works throughout, with different functions - 'do' aside, that is.
For example, there is the very powerful 'read' function.
This may take a simple string (text), a file location or a URL. You obviously know what it is and the interpreter will figure it out itself as well.
Now, let's say you want to read a file:
read "myfile.txt"
"Reading" a webpage:
read "http://somewebsite.com/somewebpage"
Parsing JSON from a remote source:
read.json "http://somewebsite.com/data.json"
Or parsing it from a string:
read.json "[1,2,3]"
And 'read' also can take different attributes, e.g. .csv (for parsing CSV files), .html etc etc...
Basically you pass a string with its options and the interpreter figures out where to get it from and what to do with it... :)
The point is to keep the syntax clean. (Ok, that would be an argument of going all the way, like Tcl, where everything ends up being a string - but let's just get the best of every world without overdoing it :) )
@9214 Since you are knowledgeable about the topic (included but not limited to Rebol/Red), I would be glad if you joined the effort. Even testing bits here and there would be great. You're welcome :)
Let me know what you think! :)
if? even? x -> print [x "is even"]
but I couldn't find it in Arithmetic, Comparison, Core, Logic, or Numbers - I figured those were the most obvious places to look.
I was wondering specifically if this example
loop 1..10 'x [ if? even? x -> print [x "is even"] else -> print [x "is odd"] ]
could be rewritten
loop 1..10 'x [ even? x -> print [x "is even"] odd? x -> print [x "is odd"] ]
and what other number checking things one could do - like decimal?, positive? negative?
Regarding the syntax:
every "function" in Arturo takes a specific number of arguments. in that case: loop, if?, even? else are ALL functions (there are no special constructs in Arturo, nor reserved keywords).
Regarding your second example/question: you could have written it like that, but it wouldn't do as you expect.
What can be done though is using the 'case function.
For any other questions, doubts, ideas or even code contribution, you're welcome to post anything at Github or via our Gitter community: https://gitter.im/arturo-lang/community or Discord: https://discord.gg/YdVK2CB
Let me know what you think! :)
Let me put it like this:
- Just open the REPL (Arturo's terminal) - Write: webview "Hello World!"
Although super-minimal, you already have a Webview-based GUI app with something in it. It's a starting point :)
Btw, have you managed to compile it on NetBSD? (It should run fine, I think, though I haven't tried it yet...)
P.S. A little bit of trivia: my choice of the scorpion logo was no random selection at all. Arturo was my little (well, not so little) Black Emperor scorpion that passed away in February. Hence, the name. And the logo...
Let me know what you think! :)
Let me know what you think! :)
Rebol - Arturo's ideological grandparent - is a great language (albeit not as well-known as it should be). And Arturo attempts to get the best bits of it and make a modern take on programming.
In the website (and the GitHub repo) you will find more than enough information about it.
Also, have a look at the wiki!
https://github.com/arturo-lang/arturo/wiki
That being said, as I've already mentioned, my goal was not to make a Rebol replica. Arturo is a new language.
Now, regarding the "inspiration" part, to anyone that is familiar with Rebol, I think it would be fair to say that Arturo does look more like the Rebol group, than an Algol-type language, or ML, or Python type of language. I don't know... (I would really be intrigued to hear what it reminds you of... :))
My understanding so far is that Arturo has VM-based interpreter (perhaps stack-based or even indirect-threaded, hence the mention of Forth as an inspiration) which operates on a syntax tree (either concrete or abstract, although Rebol uses the former) produced from textual source during lexing. Is that correct?
Regarding "homoiconicity", the way I would succintly put it is that: the line between what is considered code and what is data is super-fine. Basically, anything can be anything - depending on the context. Thus, an Arturo script can manipulate its own code, the way it can manipulate any other type of data.
Regarding Arturo's implementation: It's written in Nim (though I have written it in the past in almost every language you can think of... lol started with C++, went to D, then to Nim, back to C, and now in Nim again). Basically it's a Stack-based Bytecode Virtual Machine. And yes, Forth's influence is also important - although (intentionally) not that obvious at first sight.
The source text is parsed to an abstract structure/tree of words and symbols. That's the part that happens in translator/parse.
Then if it's an executable block, it is evaluated (as valid Arturo code) into Bytecode (this happens in translator/eval), and then this bytecode is executed by the virtual machine (in vm/exec).