:operator. The part before
:is the lambda argument, while the part after it is the returned value. Thanks to currying it's also possible to define multi-argument lambdas – all you need to do is return another lambda, e.g.
x: y: x + y.
_idiom, which we have first seen in the section on currying. All occurrences of
_inside a parenthesized expression are replaced with consecutive lambda arguments. This allows to simplify some constructions like this:
(_ + 2) + _is interpreted as
x: (y: y + 2) + x, not
x: y: (x + 2) + y.
main, the visual editor will automatically enter this function when opening the file.
defkeyword. Any functions defined this way on the module toplevel are visible by any modules importing it (and of course throughout the defining module itself). To define a function named
fooin the visual editor just type in
def fooin the explorer and press enter. This will create an empty function that you can then enter and complete the logic definition. The arguments are ports on the left hand side bar, and the returned value is connected to the right hand side.
func1function looks like this on the inside: