Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
|
|
@ -0,0 +1,6 @@
|
|||
(eval (list * 6 7))
|
||||
→ 42
|
||||
(eval '(* 6 7)) ;; quoted argument
|
||||
→ 42
|
||||
(eval (read-from-string "(* 6 7)"))
|
||||
→ 42
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
Procedure Main()
|
||||
local bAdd := {|Label,n1,n2| Qout( Label ), QQout( n1 + n2 )}
|
||||
Eval( bAdd, "5+5 = ", 5, 5 )
|
||||
Eval( bAdd, "5-5 = ", 5, -5 )
|
||||
return
|
||||
|
||||
Upon execution you see:
|
||||
5+5 = 10
|
||||
5-5 = 0
|
||||
30
Task/Runtime-evaluation/Lasso/runtime-evaluation.lasso
Normal file
30
Task/Runtime-evaluation/Lasso/runtime-evaluation.lasso
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
//code, fragment name, autocollect, inplaintext
|
||||
local(mycode = "'Hello world, it is '+date")
|
||||
sourcefile('['+#mycode+']','arbritraty_name', true, true)->invoke
|
||||
|
||||
'\r'
|
||||
|
||||
|
||||
var(x = 100)
|
||||
local(mycode = "Outside Lasso\r['Hello world, var x is '+var(x)]")
|
||||
// autocollect (3rd param): return any output generated
|
||||
// inplaintext (4th param): if true, assumes this is mixed Lasso and plain text,
|
||||
// requires Lasso code to be in square brackets or other supported code block demarkation.
|
||||
sourcefile(#mycode,'arbritraty_name', true, true)->invoke
|
||||
|
||||
'\r'
|
||||
|
||||
var(y = 2)
|
||||
local(mycode = "'Hello world, is there output?\r'
|
||||
var(x) *= var(y)")
|
||||
// autocollect (3rd param): as false, no output returned
|
||||
// inplaintext (4th param): as false, assumes this is Lasso code, no mixed-mode Lasso and text.
|
||||
sourcefile(#mycode,'arbritraty_name', false, false)->invoke
|
||||
'var x is now: '+$x
|
||||
|
||||
'\r'
|
||||
|
||||
var(z = 3)
|
||||
local(mycode = "var(x) *= var(z)")
|
||||
sourcefile(#mycode,'arbritraty_name', false, false)->invoke
|
||||
'var x is now: '+$x
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
"[ [ $a, 12], [$b, 1.2], [ $c, [ $aaa, $bbb, $ccc ] ], [ $torun, #first ] ]" perform .s
|
||||
[1] (List) [[a, 12], [b, 1.2], [c, [aaa, bbb, ccc]], [torun, #first]]
|
||||
|
||||
"12 13 +" perform
|
||||
[1:interpreter] ExCompiler : Can't evaluate <+>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
"12 13 + println" eval
|
||||
25
|
||||
": newFunction(a) a + ; 12 10 newFunction println" eval
|
||||
22
|
||||
5
Task/Runtime-evaluation/Ring/runtime-evaluation-1.ring
Normal file
5
Task/Runtime-evaluation/Ring/runtime-evaluation-1.ring
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
Eval("nOutput = 5+2*5 " )
|
||||
See "5+2*5 = " + nOutput + nl
|
||||
Eval("for x = 1 to 10 see x + nl next")
|
||||
Eval("func test see 'message from test!' ")
|
||||
test()
|
||||
12
Task/Runtime-evaluation/Ring/runtime-evaluation-2.ring
Normal file
12
Task/Runtime-evaluation/Ring/runtime-evaluation-2.ring
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
5+2*5 = 15
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
message from test!
|
||||
9
Task/Runtime-evaluation/Ring/runtime-evaluation-3.ring
Normal file
9
Task/Runtime-evaluation/Ring/runtime-evaluation-3.ring
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
while true
|
||||
see nl + "code:> "
|
||||
give cCode
|
||||
try
|
||||
eval(cCode)
|
||||
catch
|
||||
see cCatchError
|
||||
done
|
||||
end
|
||||
20
Task/Runtime-evaluation/Ring/runtime-evaluation-4.ring
Normal file
20
Task/Runtime-evaluation/Ring/runtime-evaluation-4.ring
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
code:> see "hello world"
|
||||
hello world
|
||||
code:> for x = 1 to 10 see x + nl next
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
|
||||
code:> func test see "Hello from test" + nl
|
||||
|
||||
code:> test()
|
||||
Hello from test
|
||||
|
||||
code:> bye
|
||||
3
Task/Runtime-evaluation/Sidef/runtime-evaluation.sidef
Normal file
3
Task/Runtime-evaluation/Sidef/runtime-evaluation.sidef
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
var (a, b) = (-5, 7);
|
||||
say eval '(a * b).abs'; # => 35
|
||||
say (a * b -> abs); # => 35
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
let fn = exprtofn("13 + 37");
|
||||
fn() // -> 50
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
let fn = exprtofn("#0 * #1");
|
||||
fn(3, 4) // -> 12
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
let fn = compile("for (var i = 0; i < 10; i++) { print(i); }");
|
||||
fn(); // result: 0 1 2 3 4 5 6 7 8 9
|
||||
2
Task/Runtime-evaluation/Ursa/runtime-evaluation.ursa
Normal file
2
Task/Runtime-evaluation/Ursa/runtime-evaluation.ursa
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# writes hello world to the console
|
||||
eval "out \"hello world\" endl console" console
|
||||
Loading…
Add table
Add a link
Reference in a new issue