Skip to main content

recognize_zip_map

Function recognize_zip_map 

Source
pub fn recognize_zip_map(
    stmts: &[Stmt<'_>],
    interner: &Interner,
) -> Result<ZipMap, ZipMapReject>
Expand description

Recognize a zip map anywhere in a LOGOS statement list:

Let mutable i be 0.
While i is less than n:
    Set item (i + 1) of out to blackScholes(item (i + 1) of prices, item (i + 1) of strikes, …).
    Set i to i + 1.

The loop is counted; it writes one array, out, at a unit-stride index of the counter, and every array the stored term reads is a declared Seq read at that same index; the term calls only the program’s pure functions (each inlined) and abs; and the body holds nothing else but immutable names. The first loop that is one is returned; otherwise the refusal of the loop that came closest.