RosettaCodeData/Task/Higher-order-functions/Efene/higher-order-functions.efene
2023-07-01 13:44:08 -04:00

23 lines
411 B
Text

first = fn (F) {
F()
}
second = fn () {
io.format("hello~n")
}
@public
run = fn () {
# passing the function specifying the name and arity
# arity: the number of arguments it accepts
first(fn second:0)
first(fn () { io.format("hello~n") })
# holding a reference to the function in a variable
F1 = fn second:0
F2 = fn () { io.format("hello~n") }
first(F1)
first(F2)
}