RosettaCodeData/Task/Higher-order-functions/Efene/higher-order-functions.efene
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07: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)
}