Hash :
e2ac6cb4
Author :
Thomas de Grivel
Date :
2024-09-17T16:19:53
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
fn (x) { x }
fn (x, _y) { x }
fn ([x | _y]) { x }
fn {
([]) { :error }
([x | _y]) { x }
(_) { :error }
}
fn (x) do
"Hello, world !"
x * 2
end
fn (x) { x }
1
fn (x, _y) { x }
1
fn ([x | _y]) { x }
1
fn {
([]) { :error }
([x | _y]) { x }
(_) { :error2 }
}
1
fn (x) do
"Hello, world !"
x * 2
end
4
do
f = fn (x) do
puts("Hello, world !")
x * 2
end
f(2)
end
Hello, world !
4
f = fn (x) { fn (y) { x * y } }
fn (x) { fn (y) { x * y } }
g = f(2)
fn (y) { x * y }
g(3)
6