Category:Arturo: Difference between revisions

From Rosetta Code
Content added Content deleted
No edit summary
Line 17: Line 17:


There are no "special" language constructs (''even <code>if</code> is nothing but a simple statement''). Everything you see is a statement in the form <code>ID <expression> <expression> <expression> ...</code>
There are no "special" language constructs (''even <code>if</code> is nothing but a simple statement''). Everything you see is a statement in the form <code>ID <expression> <expression> <expression> ...</code>
<br>

====Code is data - and data is code====
====Code is data - and data is code====


Arturo can be used both as a data-interchange format and a programming language. Basically all data structures are valid code and all code can be represented as a data structure. Think of it as [[SDL]]/[[Json]]/[[YAML]]/[[XML]] combined with the power of [[Lisp]] - but without the... sea of opening and closing parentheses.
Arturo can be used both as a data-interchange format and a programming language. Basically all data structures are valid code and all code can be represented as a data structure. Think of it as [[SDL]]/[[Json]]/[[YAML]]/[[XML]] combined with the power of [[Lisp]] - but without the... sea of opening and closing parentheses.
<br>

====Each statement returns a value====
====Each statement returns a value====


Whether what you would consider a "function" or any other statement, it will return a value. If it's a block of code (see: ''function''), the last statement's result will be return - unless specified otherwise.
Whether what you would consider a "function" or any other statement, it will return a value. If it's a block of code (see: ''function''), the last statement's result will be return - unless specified otherwise.
<br>

====Functions are first-class citizens====
====Functions are first-class citizens====


Functions - or blocks of statements enclosed in <code>{}</code> - can be anything. Assign them to a symbol/variable, pass them around as arguments to function calls, include them as a dictionary key value, or return them from a function. And of course they can be either named or anonymous/lambda.
Functions - or blocks of statements enclosed in <code>{}</code> - can be anything. Assign them to a symbol/variable, pass them around as arguments to function calls, include them as a dictionary key value, or return them from a function. And of course they can be either named or anonymous/lambda.
<br>

====Uniform syntax====
====Uniform syntax====



Revision as of 08:08, 9 October 2019

Language
Arturo
This programming language may be used to instruct a computer to perform a task.
Official website
Execution method: Interpreted
Garbage collected: Yes
Parameter passing methods: By value
Type safety: Safe
Type strength: Strong
Type checking: Dynamic
Lang tag(s): arturo
See Also:


Listed below are all of the tasks on Rosetta Code which have been solved using Arturo.

Arturo is a general-purpose, multi-paradigm language that aims to be simple, modern and powerful, vaguely inspired by various other ones - including but not limited to Ruby, Haskell, D, SDL (Simple Declarative Language), Tcl and Lisp.

Principles

It is built on some very simple and straightforward principles:

Everything is a simple statement

There are no "special" language constructs (even if is nothing but a simple statement). Everything you see is a statement in the form ID <expression> <expression> <expression> ...

Code is data - and data is code

Arturo can be used both as a data-interchange format and a programming language. Basically all data structures are valid code and all code can be represented as a data structure. Think of it as SDL/Json/YAML/XML combined with the power of Lisp - but without the... sea of opening and closing parentheses.

Each statement returns a value

Whether what you would consider a "function" or any other statement, it will return a value. If it's a block of code (see: function), the last statement's result will be return - unless specified otherwise.

Functions are first-class citizens

Functions - or blocks of statements enclosed in {} - can be anything. Assign them to a symbol/variable, pass them around as arguments to function calls, include them as a dictionary key value, or return them from a function. And of course they can be either named or anonymous/lambda.

Uniform syntax

As already mentioned, everything is a statement of the form `ID <expressions>`. So, how does this work?

  • Is it the first time you are declaring this symbol? Then, the right-hand value will be assigned.
  • Is it not the first time? Then again, the right-hand value will be assigned.
  • Do you want to call a function you have declared, by name? Just prefix it with an exclamation mark. E.g.: !myFunc "some arg" "another arg"
  • Do you want to use the result of a function call as part of an expression? Just enclose the function call in $(...) E.g.: print $(reverse #(1 2 3))

Implementation

The main Arturo interpreter is written in the D language.

License

Arturo is released under the MIT/X11 License.

Todo

Reports:Tasks_not_implemented_in_Arturo

Subcategories

This category has only the following subcategory.

@

Pages in category "Arturo"

The following 200 pages are in this category, out of 779 total.

(previous page) (next page)

C

(previous page) (next page)