Jamie Balfour

Welcome to my personal website.

Find out more about me, my personal projects, reviews, courses and much more here.

Official ZPE/YASS documentationInline iteration

Inline iteration was added in ZPE 1.11.2 (OmegaY, February 2023) and it brings about a few new simplicities.

What is inline iteration?

Inline iteration is similar to the match statement in it's purpose. The match statement allowed for conditional evaluation to take place within assignment and expression evaluation. Inline iteration carries out a similar purpose, allowing iteration to take place within assignment and expression evaluation.

Firstly, within the context of list declarations, it becomes much easier to define a list of numbers ranging from a lower to upper number:

YASS
$nums = from 5 to 15

Further to this, using lambda functions, it is possible to define a sequence of expression generation within the context of the array.

YASS
print(from 0 to 1000 : function ($x) { return $x * 2 })
evaluate(from 0 to 1000 : function ($x) { print($x) })

When using a lambda function with this, the first parameter, if provided, will contain the iteration number that the loop is at.

The result in both cases is a ZPEList of n elements as defined.

Comments

There are no comments on this page.

New comment

Comments are welcome and encouraged, including disagreement and critique. However, this is not a space for abuse. Disagreement is welcome; personal attacks, harassment, or hate will be removed instantly. This site reflects personal opinions, not universal truths. If you can’t distinguish between the two, this probably isn’t the place for you. The system temporarily stores IP addresses and browser user agents for the purposes of spam prevention, moderation, and safeguarding. This data is automatically removed after fourteen days.

Comments powered by BalfComment

Feedback 👍
Comments are sent via email to me.