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 45 46 47 48 49
quote fn (x) { x }
quote fn (x, _y) { x }
quote fn ([x | _y]) { x }
quote fn {
([]) { :error }
([x | _y]) { x }
(_) { :error }
}
quote fn (x) do
"Hello, world !"
x * 2
end
a = fn (x) { x }
a(1)
b = fn (x, _y) { x }
b(1, 2)
c = fn ([x | _y]) { x }
c([1, 2])
d = fn {
([]) { :error }
([x | _y]) { x }
(_) { :error2 }
}
d([1, 2])
e = fn (x) do
"Hello, world !"
x * 2
end
e(2)
quote do
f = fn (x) do
puts("Hello, world !")
x * 2
end
f(2)
end
do
f = fn (x) do
puts("Hello, world !")
x * 2
end
f(2)
end
quote f = fn (x) { fn (y) { x * y } }
f = fn (x) { fn (y) { x * y } }
quote g = f(2)
g = f(2)
quote g(3)
g(3)