-
-
Notifications
You must be signed in to change notification settings - Fork 85
/
reia.scroll
117 lines (92 loc) · 2.87 KB
/
reia.scroll
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import ../code/conceptPage.scroll
id reia
name Reia
appeared 2008
tags pl
website http://reia-lang.org
writtenIn reason erlang bourne-shell ruby markdown
repoStats
firstCommit 2008
commits 1465
committers 14
files 110
newestCommit 2012
country United States
originCommunity https://github.com/tarcieri/reia/issues
reference http://www.unlimitednovelty.com/2011/06/why-im-stopping-work-on-reia.html
example
# Hello, world!
"Hello, world!".puts()
# Assignment
number = 42
opposite = true
# Conditions
number = -42 if opposite
# Lists (stored as immutable singly-linked lists)
list = [1, 2, 3, 4, 5]
# Tuples (think of them as immutable arrays)
tuple = (1, 2, 3, 4, 5)
# Atoms (known as symbols to Ruby people)
# Think of them as an open-ended enumeration
atom = :up_and_atom
# Dicts (also known as hashes to Ruby people)
dict = {:foo => 1, :bar => 2, :baz => 3}
# Strings (unlike Erlang, Reia has a real String type!)
string = "I'm a string! Woohoo I'm a string! #{'And I interpolate too!'}"
# Ranges
range = 0..42
# Funs (anonymous functions, a.k.a. lambdas, procs, closures, etc.)
# Calling me with plustwo(40) would return 42
plustwo = fun(n) { n + 2 }
# Modules (collections of functions)
# Calling Plusser.addtwo(40) would return 42
module Plusser
def addtwo(n)
n + 2
end
end
# Classes (of immutable objects. Once created objects can't be changed!)
class Adder
# Reia supports binding instance variables directly when they're passed
# as arguments to initialize
def initialize(@n); end
def plus(n)
@n + n
end
end
# Instantiate classes by calling Classname(arg1, arg2, ...)
# For you Ruby people who want Classname.new(...) this is coming soon!
fortytwo = Adder(40).plus(2)
# Function references can be obtained by omitting parens from a function call,
# like JavaScript or Python
numbers = [1,2,3]
reverser = [1,2,3].reverse
# Function references can be invoked just like lambdas
reversed = reverser() # reversed is now [3,2,1]
# You can add a ! to the end of any method to rebind the method receiver to
# the return value of the given method minus the bang.
numbers.reverse!() # numbers is now [3,2,1]
# List comprehensions
doubled = [n * 2 for n in numbers] # doubled is [6,4,2]
githubRepo https://github.com/tarcieri/reia
firstCommit 2008
stars 777
forks 40
subscribers 13
created 2008
updated 2022
description Ruby-like hybrid OOP/functional programming language for BEAM, the Erlang VM
issues 7
lineCommentToken #
printToken puts
assignmentToken =
hasAssignment true
hasLineComments true
# A comment
hasComments true
# A comment
domainName reia-lang.org
registered 2008
hackerNewsDiscussions
id|title|url|time|timestamp|by|comments|score
1889905|Reia - Ruby's powerful syntax with Erlang concurrency and fault-tolerance|http://reia-lang.org/|2010-11-10 11:10:55 UTC|1289387455|rubyrescue|1|2