Sha256: 5fd413b8007aca49d61f0162bb0194c65b059ffdbe9d2e4eb726b578ee4100cd
Contents?: true
Size: 1.54 KB
Versions: 2
Compression:
Stored size: 1.54 KB
Contents
1 1+2 4-7 3*2 6/2 6.0-0.5 5%2 1>2 1>=1 3<1 7<=0 (2>0) and (3<1) true or false x=1 x+2 x=1 y=2 x+y soma = [a,b| a+b] soma(3,4) soma = [a,b| a+b] soma(3,4)+10 soma = [a,b| sum] : (sum = a+b) soma(10,5) fib = [1|1], [2|1], [n| fib(n-1)+fib(n-2)] fib(8) x=1 y=2 f=[x| x+y] f(10) if (true, 1, 2) if (false, 1, 2) begin(1,2,3,4) {obj: x, y} = {obj: 1, 2} x+y {obj: 5, 10, z} = {obj: 5, 10, 15} z [{obj: 10, x}| x]({obj: 10, -5}) [{obj: {algo}, x}| x]({obj: {algo}, 13}) [{obj: {algo: 10}, x}| x]({obj: {algo: 10}, 1}) [{obj: {algo: x}, y}| x+y]({obj: {algo: 1}, 2}) [{obj: {algo: x}, y}, 1, z, {ok}| x+y+z]({obj: {algo: 1}, 2}, 1, 10, {ok}) [{ok}| 10]({ok}) {obj: 1, x} -> f = [x] {obj: 2, x} -> f = [x+1] a = {obj: 2, 20} a -> f() {obj: 1, x} -> f = [x] {obj: 2, x} -> f = [x+1] a = {obj: 1, 20} a -> f() {obj: x} -> f = [x-1] {obj: 1} -> f() {obj: 1, 2, 3, x} -> f = [1+2+3+x] {obj: 1, 2, 3, 10}->f() f = [_,x,_| x*2] f(1,2,3) f = [{obj: {xxx: _}, x}, y| x+y] f({obj: {xxx: 1}, 2}, 3) list_sum = [{list: head, tail}| head + list_sum(tail)], [{list}| 0] list_sum({list: 1, {list: 2, {list}}}) f = [x| x(10)] g = [x| x+1] f(g) "aaaaa"->append("bbbbb") "aaaaa"->equal("bbbbb") "aaaaa"->equal("aaaaa") "abcde"->at(2) "abcde"->capitalize() "abcde"->center(10) "aBcDe"->downcase() "aBcDe"->is_empty() "0xB"->hex() "abcde"->index("c") "abcde"->insert(3, "X") "abcde"->length() "10"->oct() "abcde"->reverse() "10"->to_integer() "10.11"->to_decimal() "aBcDe"->upcase() (-1)->abs() (-1)->next() (-1)->to_decimal() (-1)->to_string() (-1.1)->abs() (-1.1)->ceil() (-1.1)->floor() (-1.1)->to_string()
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
p-lang-0.1.1 | test/test_vm_programs.txt |
p-lang-0.1.0 | test/test_vm_programs.txt |