Step 1.1: Getting started with WarpScript
What is WarpScript?
WarpScript is a programming language specific to Geo time series® analysis. For security reason, WarpScript is an interpreted language, which means that a Warp 10 backend have to be reached to execute your script. Fortunately for you, we set-up everything you need in this tutorial.
If you are at a conference and you want want to use Quantum directly, here’s a direct link. Be aware that you will need to copy/paste the scripts.
WarpScript Stack
WarpScript is a stack related programming language. This means that to compute an operation, you first have to:
- put all the parameters on the stack
- then put the operator
If a result is produced, it will be pushed on top of the stack.
Single operator
Let’s start with a simple WarpScript function: NOW
. This function will put on the stack the current time (in microseconds) since the Unix epoch. Let’s play with it, as quantum was set to reach an available backend, just type NOW
in the quantum editor, then click on execute.
Congratulation, you wrote and exectute your first WarpScript! You should see the current time (in microsecond) in the answer session below.
Warp10 is by default configured to use the micro-second as a time-unit.
Basic operation in WarpScript
Let’s compute an operation in WarpScript, but first, in WarpScript, you will find commentary and variable types. The following WarpScript example list all the available basic types.
To compute an operation (for example an addition), put the two elements before the operator +
on the stack.
You will get the result on top of the stack.
Let’s try it, by implementing the follwing spec:
Pro tips: You can always use
STOP
. This function is useful when debugging WarpScript code as it allows you to interrupt your code at specific points of the execution.
To be continued
WarpScript allow the user to save specific data inside variable, the follwing page will detail how to use them!