Category:Arturo: Difference between revisions

From Rosetta Code
Content added Content deleted
No edit summary
m (minor edit)
 
(12 intermediate revisions by 2 users not shown)
Line 2: Line 2:
|exec=interpreted
|exec=interpreted
|strength=strong
|strength=strong
|safety=safe
|checking=dynamic
|checking=dynamic
|express=implicit
|parampass=value
|site=http://arturo-lang.io
|site=https://arturo-lang.io
|tags=arturo
|tags=arturo
|gc=yes}}
|gc=yes}}
'''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]].
Arturo is an independently-developed, modern programming language, vaguely related to various other ones - including but not limited to [[Logo]], [[Rebol]], [[Forth]], [[Ruby]], [[Haskell]], [[D]], [[SmallTalk]], [[Tcl]] and [[Lisp]].


The language has been designed following some very simple and straightforward principles:
===Principles===


* Code is just a list of words and symbols
It is built on some very simple and straightforward principles:
* Words and symbols within a block are interpreted - when needed - according to the context
* No reserved words or keywords - look for them as hard as you can; there are absolutely none


<syntaxhighlight lang="arturo">
====Everything is a simple statement====
factorial: function [n][
if? n > 0 -> n * factorial n-1
else -> 1
]


loop 1..19 [x]->
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>
print ["Factorial of" x "=" factorial x]
</syntaxhighlight>


===Implementation===
====Code is data - and data is code====
The main compiler is implemented in [[Nim]]/[[C]] as a Bytecode interpreter / Stack-based VM and should run in most architectures.


The main goals are: expressiveness, brevity, performance and portability. (With that exact order)
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 <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.

====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.: <code>!myFunc "some arg" "another arg"</code>
* Do you want to use the result of a function call as part of an expression? Just enclose the function call in <code>$(...)</code> E.g.: <code>print $(reverse #(1 2 3))</code>

===Implementation===
The main Arturo interpreter is written in the [[D]] language.


===License===
===License===
Line 46: Line 34:


===Todo===
===Todo===
[[Tasks not implemented in Arturo]]
[[Reports:Tasks_not_implemented_in_Arturo]]


{{language programming paradigm|Concatenative}}
{{language programming paradigm|Declarative}}
{{language programming paradigm|Dynamic}}
{{language programming paradigm|Functional}}
{{language programming paradigm|Imperative}}
{{language programming paradigm|Imperative}}
{{language programming paradigm|Object-oriented}}
{{language programming paradigm|Functional}}
{{language programming paradigm|Reflective}}
{{language programming paradigm|Reflective}}

Latest revision as of 16:00, 7 March 2023

Language
Arturo
This programming language may be used to instruct a computer to perform a task.
Official website
Execution method: Interpreted
Garbage collected: Yes
Type strength: Strong
Type expression: Implicit
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 an independently-developed, modern programming language, vaguely related to various other ones - including but not limited to Logo, Rebol, Forth, Ruby, Haskell, D, SmallTalk, Tcl and Lisp.

The language has been designed following some very simple and straightforward principles:

  • Code is just a list of words and symbols
  • Words and symbols within a block are interpreted - when needed - according to the context
  • No reserved words or keywords - look for them as hard as you can; there are absolutely none
factorial: function [n][
	if? n > 0 -> n * factorial n-1
	else 	  -> 1
] 

loop 1..19 [x]->
	print ["Factorial of" x "=" factorial x]

Implementation

The main compiler is implemented in Nim/C as a Bytecode interpreter / Stack-based VM and should run in most architectures.

The main goals are: expressiveness, brevity, performance and portability. (With that exact order)

License

Arturo is released under the MIT/X11 License.

Todo

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)