# Advanced Usage

This section shows some more advanced usage.

## Clever

Waltz understands Javascript — with a few extra :

•   classical mathematical functions are directly available (i.e. all the members of the Math object are on the root) ;

•   the value of PI is also attached to the π symbol ;

•   ° can be used as a shortcut for *π /180.

Waltz knows a lot of operators and functions, and is ready to extend itself, with your own functions — a bit like you extend the power of Excel by writing your own formulas (see the welcome page, inside the product).

Waltz
sqrt(9) 3 π 3.141592653589793 sin(45°) 0.7071067811865475
|

## Open

You can extend the functionality of Waltz without learning any new proprietary concepts, using the world most used programming language... tutorials about Javascript abound all around the Web.

Waltz works with Numbers (in any base), Strings, Booleans, Arrays, Dictionaries, or other Objects (from simple ones — like Dates, to very complex ones — like JSON Objects).

Waltz can fetch remote data to work on — using classical Internet protocols — from your lab instruments, or from the entire world : call the raw function, with the URL of the data as parameter (see the welcome page, inside the product).

Waltz can also fetch remote libraries, using the require function, with the URL of the library as parameter.

Waltz
0xA113 41235 decodeURI("%4F%4B") "OK" 1+2<5 true new Date("6 oct 63") Sun Oct 06 1963
|

## Extensible

Waltz takes care of any expression you give... by "enveloping" it before asking for a Javascript evaluation.

An envelope is a string, where the sequence %@ is replaced by the line entered. The default envelope is “%@” -- so the default behaviour is to evaluate the string just as it was given.

You can change this default behaviour, by modifying the envelope property — in this simple example, hours are now evaluated in minutes automatically.

Expressions starting with a space always evaluate with the default envelope — this is needed, of course, for re-defining another envelope !

Waltz
1/2 0.5 envelope="(%@)*60" 1/2 30
|

## Contextual

The envelope feature that modifies the default behaviour, is mostly used to access methods, or to format results, seamlessly.

For defining the context in which Waltz will evaluate expressions, in order to avoid having to enter and re-enter envelopes, to fetch and re-fetch libraries, you can define so called "extensions" : text files with operations to be executed systematically at startup.

Press and hold down the symbol to get the list of existing extensions, then, create a new file, or touch the to view or edit one existing file, or swipe one item to the left to delete it.

The name of the extension is given by the text in the first line of the file, generally a comment.

Feel free to challenge your own creativity, discovering the power in your hands !

Comments and suggestions are welcome.

© 2015, Frédéric Blondiau — DouWère, s.p.r.l.