Hi friends - been playing around with Orca and just wanted to share a cool construct.
I wanted to create an oscillating clock (e.g. 0 to z back to 0 and so on), but it looks like the suggested approach is to now use the following construct:
Cy.
1Bh
However, the largest period we can get from this is only 2*h ticks, because the second operand of B has to be half our clock:
Here’s what I came up with instead:
.25O.....
...00O0z.
....Z0B..
....0F0..
.....*i2.
......1..
Despite its messiness, I’m quite proud of this iteration as my previous attempts at such a clock broke if you tried to change the range halfway through the period, but this one seems pretty solid. It works by comparing Z's output to its target such that when the two are equal, we switch Z's target to the next endpoint of our oscillation.
The above snippet oscillates within [0,z], but we can specify the lower-bound too, e.g. the following would oscillate within [2,7].
...00O27.
You can get pretty crazy and form some elaborate oscillations by changing the pattern length too. The following goes from 2 to a, down to 7, up to g, and back down to 2:
.25O.......
...00O2a7g.
....Z0B....
....1F0....
......i4...
......0....
Orca is really cool and I’m having a lot of fun with it. Thanks for this awesome language!