:
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.def
keyword. 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 foo
in the visual editor just type in def foo
in 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.func1
function looks like this on the inside: