-
-
Notifications
You must be signed in to change notification settings - Fork 4
function pointer
Functions in Angle are charged, like in ruby/crystal:
time := now
time # prints 2020-11-11|11:00.12 or similar
time # prints 2020-11-11|11:00.13 or similar
In blocks (function body declarations), the evaluation is delayed, as seen above
Unlike ruby function pointers are first class citizens in Angle: The symbol :now is different from the function pointer &now.
If one prefers verbal syntax to sigils, function pointers can be used with function
or func
keyword:
map function square on [1 2 3] == [1 4 9]
map square on [1 2 3] == [1 4 9]
would work just as fine because
1.) map has signature map of block and object ...2.) square is followed by keyword 'on' which can not be an argument to square (unless there was a signature
square on list = ...` even then the ambiguity might be resolved)