Visual FLX language is based under the hood on FLX Lisp. Lisp is a functional programming language and so is FLX Lisp. FLX provide an extensive set of built-in functions including the functions that are used to build applet UIs in declarative way. Beside built-in functions FLX provides macro functions that can be used, for instance, to define new custom functions.
Some examples of FLX functions:
- A built-in function called substring which takes two arguments, String and Int and returns a substring of the given string starting from the specified index.
- A user defined function with name sum. This function is defined to have two arguments x and y. The body of the function is implemented using addition (+) function which is also a built-in function.
- Invocation of the defined function sum with parameters 1 and 2.
- An anonymous user defined function without a function name. Anonymous functions can be used like closures.
Macro functions are special functions that used as higher level functions. Currently FLX language defines the following macro functions:
- Block: Contains nested code. Blocks are not scoped which means, that functions and variables defined inside a block are also visible and accessible outside a block.
- callback: A callback can be used to implement closures since they define code and input parameters for the code.
- fun: A macro function that is used to define new functions.
- val: A macro that defines an immutable value i.e. constant. Similar to Kotlin’s val definition.
- var: A macro that defines a mutable variable. Similar to Kotlin’s var definition.
- eval and quote: Macro functions from Lisp. Function eval evaluates the value of the given form whereas quote does not evaluate its parameter.
- parse: A function that parses the the given literal expression and converts it to a form.