In this page you can find some working snippets of EveXL. Just copy and paste them in the code editor at the end of the page to try them out (or use the "Try this!" buttons to save some time). You can also edit the code as you please. Time to get creative!

P.S.: Don't forget to turn on the stream generator after writing the expressions in the editor!

Example 1 - Simply red

This expression will match a single reading of the "color" sensor as 'red'. Pretty simple! It should be read as:

Example 2 - Simply red... only longer

This expression will match three succeeding readings of 'red'. It reads like:

Example 3 - One interval, 3 colors

This expression will match an interval with duration 3, during which the "color" sensor reads values of 'red', 'green' or 'blue'.

Example 4 - Two intervals

This expression will match two intervals with different color readings, regardless of the order they take place:

Example 5 - The meeting of two intervals

What if we wanted to detect when our sensor stops reading green and starts reading red?

Example 6 - Two intervals meet, second lasts longer

This is the same as the previous expression, but this time the second interval (red readings) lasts longer than the first (green readings):

Example 7 - The meeting of three progressively longer intervals

This is the same as Example 6, though with three progressively longer intervals:

Example 8 - Covering ground

What if we were interested in detecting different situations? This event will succeed on either 1 reading of 'red', or 2 readings of 'green' or 3 readings of 'blue'.

Example 9 - Timespan

We could, of course, be interested in events taking place temporally close to one another. Let's find when a single red and a single blue ball fall with, at most, 2 readings in between.

Here's an alternative expression:

Example 10 - Blue, wait... bingo!

Let's trigger an event sometime after something else occurred. In this case, this event will trigger two readings after an interval of blue balls has ended.

Partial Matching

Intervals of time can be divided in smaller intervals. After all, when you spend an interval of 2 hours watching TV, you have also spent 2 intervals of 1 hour watching TV, 4 intervals of 30 minutes, and so on... EveXL makes possible to consider these subintervals, by using the PARTIAL keyword after declaring an interval.

Example 11 - Single blue, wait... bingo!

For instance, the following event will trigger two readings after a blue ball is detected, even if the subsequent readings are also of blue balls.

Example 12 - Three green balls

The following event will trigger whenever three green balls are detected one after the other, even if they're part of a longer interval of sequential green readings.

Time Juggling

The following examples just use time intervals. Since we are only interested in the passing of time, the generator will act as a water clock: regardless of their color, each item drop counts as a time unit (clepsydra).

P.S.: Since in the following snippets we don't care about colors, it's always possible to write equivalent (and simpler) expressions involving only a single interval of time with a fixed duration... but, hey - where's the fun in that?

Example 13 - Just time

Example 14 - With age comes wisdom

You know that feeling that as we grow older time seems to just slip away faster? Well, here's an EveXL expression for that perception.

Example 15 - Twilight Zone

This expression is a temporal model of the morning twilight (i.e., light before sunrise). For clarity, here's a visual model (CC 3.0):

Twilight subcategories

The expression should be read as:

Try It!

The generator below will produce a random stream of readings (remember: use the colored buttons to create readings), so write whatever expression you'd like to try or copy one of the above!