C10 - initial

each (Sifts)
TypeCorrade progressive sift
DescriptionThe each sift will return a strided list given a supplied number.
Last ChangesNone

The each sift will return a strided list given a supplied number.


Position Type Description Example
0 an integer return a strided list with the given stride number 2


The following sift when added to a command will return each second element in the list starting and including the first zero-indexed element:

    "sift", wasListToCSV([
        "each", 2

Effect on Returned Data

Given the input


the expected output is:



  • Formally, given a list $L$ of elements, the each sift will return the subset $L_{s} = \{ e | e = ip, \forall i : \mathbb{N} \mapsto \lbrack 0, n ) \mathtext{ and } p : \mathbb{N} \mapsto {N} \}$ where $n$ represents the length of the list $L$, $i$ are indices of the list and $p$ is the stride. This may seem counter-intuitive for non-programmers since the selection is expected to start from $p$ ignoring indices that conventionally start at $0$. That is, the selection formula for the subset $L_{s}$ is expected to be $e = ip + 1$. In case the latter behaviour is desired, then an additional skip sift can be used to offset the start of the list such that the selection formula for the subset $L_{s}$ becomes $e = ip - (p - 1)$.

For example, suppose that each second element in a list would have to be selected without accounting for zero-based indexed arrays or lists, then the sift would be:

    "sift", wasListToCSV([
        "skip", 1,
        "each", 2

similarly, for each third element in a list:

    "sift", wasListToCSV([
        "skip", 2,
        "each", 3

secondlife/scripted_agents/corrade/api/sifts/each.txt ยท Last modified: 2022/11/24 07:46 by

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key

For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.