2.5 KiB
2.5 KiB
bool | int | float | string | list | fn1_test | fn2_test | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
true | 1 | 1.1 | foo all |
|
`fn1()` | Another test `fn2()` |
id: fn1
...
1 + 2 + 3
With scape:
---
id: fn2
...
"\#x"
With arg:
---
id: fn3
args:
n: str
...
#n == #n
With lang and args:
---
id: fn4
lang: fennel
args:
a: 1
b: 2
...
(* #a #b)
With cmd (ignores lang):
---
id: fn5
cmd: python -E -X utf8
args:
n: 2
...
#n + #n
With shift:
---
id: fn6
shift: true
...
"The literate block is shifted by its eval result."
With wipe:
---
id: fn7
wipe: true
...
"This evals but it is wipe from doc."
With typed:
---
id: fn4
typed: true
args:
a: 1
b: 2
...
#a * #b
With link and alt:
---
id: fn8
lang: graphviz
link: ./graph.png
alt: A graph.
...
digraph G {
a -> b;
b -> c
c -> a;
}
With img and alt:
---
id: fn9
lang: graphviz
img: ./graph.png
alt: A graph.
...
digraph G {
a -> b;
b -> c
c -> a;
}
With dump and quote:
---
id: fn10
dump: ./dump.txt
quote: true
...
This code is saved into './dump.txt' because of 'dump'.
This code is not evaluated because 'quote' is true.
With inner function:
---
id: fn11
args:
x: 2
...
`fn1()` * x
With inner function with args:
---
id: fn12
args:
y: 1
z: 2
...
#y + `fn4(3, 4)` + #z
With inner inner function:
---
id: fn13
args:
a: 1
...
#a + `fn4(#a, `fn1()`)`
Code Blocks That Are Not Declarations
Always ignored:
---
echo "Ignore me!"
Calls and Data Types
fn3(true)
fn3(false)
fn3([])
fn3([0, 1])
fn3({})
fn3({"k1": 1, "k2": 2})
fn4(3)
fn5(1.0)
fn5("str")
Messy Calls
fn1( )
fn3("\"str\"")
fn3( 4)
fn3(5 )
fn3( 6 )
fn3( n: 7)
fn3(n: 8 )
fn3( n: 9 )
fn3(n:10)
fn4( a: 6, b: 7)
fn4( a: 8 , b: 9)
fn4( a: 10 , b: 11)
fn4( a: 12 , b: 13)
fn4( a: 14 , b: 15 )
fn4(a:16,b:17)