2023-03-14 15:40:43 -06:00
|
|
|
# Calls Before Declarations
|
|
|
|
|
2023-03-14 15:46:51 -06:00
|
|
|
- A common call: fn1(). All calls results should be print on `--verbose`.
|
|
|
|
- fn1() another common call.
|
|
|
|
- fn1()
|
|
|
|
- Two calls: fn1() and fn1().
|
|
|
|
- Two consecutive calls: fn1() fn1().
|
|
|
|
- A call with one arg: fn2(1).
|
|
|
|
- A call with two args: fn3(2, 3).
|
|
|
|
- A call with args as kwargs: fn2(n: 2) and fn3(b: 4, a: 5).
|
2023-03-14 15:40:43 -06:00
|
|
|
|
|
|
|
# Declarations
|
|
|
|
|
|
|
|
A declaration:
|
|
|
|
|
|
|
|
-- fn1()
|
|
|
|
1 + 2 + 3
|
|
|
|
|
|
|
|
All declarations should be print on `--verbose`.
|
|
|
|
|
2023-03-14 15:46:51 -06:00
|
|
|
A declaration with one arg:
|
2023-03-14 15:40:43 -06:00
|
|
|
|
|
|
|
-- Also valid, Lua is the default: fn2(n)
|
|
|
|
#n .. " " .. #n
|
|
|
|
|
|
|
|
A declaration with two args:
|
|
|
|
|
|
|
|
; Changed lang and no space:fn3(a, b) -> fennel
|
|
|
|
(* #a #b)
|
|
|
|
|
|
|
|
A declaration with lang options:
|
|
|
|
|
|
|
|
# fn4(n) -> python -E -X utf8
|
|
|
|
#n * #n
|
|
|
|
|
|
|
|
A declaration with arg and scaped:
|
|
|
|
|
|
|
|
-- fn5(x)
|
|
|
|
#x .. "\#x"
|
|
|
|
|
|
|
|
# Calls and Data Types
|
|
|
|
|
2023-03-14 15:46:51 -06:00
|
|
|
- fn2(3); integer
|
|
|
|
- fn2(1_000); integer with separator
|
|
|
|
- fn4(1.0); float
|
|
|
|
- fn5("str"); string
|
|
|
|
- fn5(true)
|
|
|
|
- fn5(false)
|
|
|
|
- fn2([]); empty array / list / sequential table
|
|
|
|
- fn2([0, 1]); array / list / sequential table
|
|
|
|
- fn2({}); empty dict / table
|
|
|
|
- fn2({"k1": 1, "k2": 2}); dict / table
|
2023-03-14 15:40:43 -06:00
|
|
|
|
|
|
|
# Messy Calls
|
|
|
|
|
2023-03-14 15:46:51 -06:00
|
|
|
- fn1( )
|
|
|
|
- fn2( 4)
|
|
|
|
- fn2(5 )
|
|
|
|
- fn2( 6 )
|
|
|
|
- fn2( n: 7)
|
|
|
|
- fn2(n: 8 )
|
|
|
|
- fn2( n: 9 )
|
|
|
|
- fn2(n:10)
|
|
|
|
- fn3( a: 6, b: 7)
|
|
|
|
- fn3( a: 8 , b: 9)
|
|
|
|
- fn3( a: 10 , b: 11)
|
|
|
|
- fn3( a: 12 , b: 13)
|
|
|
|
- fn3( a: 14 , b: 15 )
|
|
|
|
- fn3(a:16,b:17)
|