Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
4
Task/Call-a-function/ArkScript/call-a-function-1.ark
Normal file
4
Task/Call-a-function/ArkScript/call-a-function-1.ark
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# function call with no arguments
|
||||
(foo)
|
||||
# function call with fixed number of arguments
|
||||
(bar 1 2)
|
||||
3
Task/Call-a-function/ArkScript/call-a-function-2.ark
Normal file
3
Task/Call-a-function/ArkScript/call-a-function-2.ark
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(macro foo (...args) (print args))
|
||||
(foo) # => []
|
||||
(foo 1 2 3) # => [1 2 3]
|
||||
6
Task/Call-a-function/ArkScript/call-a-function-3.ark
Normal file
6
Task/Call-a-function/ArkScript/call-a-function-3.ark
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
(let foo (fun ()
|
||||
4 # this value will be discarded as it has no effect
|
||||
(compute_something 1 2 3) # the return value will be discarded too
|
||||
5 ))
|
||||
|
||||
(print (foo)) # => 5
|
||||
6
Task/Call-a-function/ArkScript/call-a-function-4.ark
Normal file
6
Task/Call-a-function/ArkScript/call-a-function-4.ark
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
(mut a 5)
|
||||
(let foo (fun (bar)
|
||||
(set bar 12)))
|
||||
(print a) # => 5
|
||||
(foo a)
|
||||
(print a) # => 5
|
||||
3
Task/Call-a-function/ArkScript/call-a-function-5.ark
Normal file
3
Task/Call-a-function/ArkScript/call-a-function-5.ark
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(if (= 5 (foo))
|
||||
(compute_something)
|
||||
(print "uhoh"))
|
||||
4
Task/Call-a-function/ArkScript/call-a-function-6.ark
Normal file
4
Task/Call-a-function/ArkScript/call-a-function-6.ark
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
(let foo (fun () ()))
|
||||
|
||||
(print (type foo)) # => Function
|
||||
(print (type print)) # => CProc
|
||||
8
Task/Call-a-function/ArkScript/call-a-function-7.ark
Normal file
8
Task/Call-a-function/ArkScript/call-a-function-7.ark
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
(import std.Macros)
|
||||
|
||||
(let test_func (fun (a b c) (* a b c)))
|
||||
(let test_func1 (partial test_func 1))
|
||||
(let test_func2 (partial test_func1 2))
|
||||
|
||||
(print (test_func1 2 3)) # => 6
|
||||
(print (test_func2 3)) # => 6
|
||||
Loading…
Add table
Add a link
Reference in a new issue