Skip to content

function pointer

pannous edited this page Nov 14, 2020 · 2 revisions

Functions in Angle are charged, like in ruby/crystal:
⚠️ Functions are invoked without parentheses!

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]

⚠️ Explicit function pointers are only necessary when the symbol could be mistaken for a function call otherwise:

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)

Home

Philosophy

data & code blocks

features

inventions

evaluation

keywords

iteration

tasks

examples

todo : bad ideas and open questions

⚠️ specification and progress are out of sync

Clone this wiki locally