-
-
Notifications
You must be signed in to change notification settings - Fork 4
functor
Pannous edited this page Dec 19, 2022
·
10 revisions
A functor is a higher order function which takes code blocks (closures) or function pointers as argument.
They can be evaluated with () or !
E.g.
map function on list := for each l in list: function!(l)
map square on [1 2 3] == [1 4 9]
IF condition:block then:block otherwise:block?
if(condition()) : then()
else otherwise()
end
redefining if. calling optional blocks results in nop_ if empty