def osa.row

shake@0.7.0.0 · src/cli.bend:2288

import shake@0.7.0.0/src/cli.bend as Cli
import Base

2288# the rest of a row for the char `ca`, whose char before is `pa`: `ps` is the
2289# row above from the cell above-left on, `qs` the row two up from two cells
2290# left on, `pb` the char of `bs` before its head
2291def osa.row(
2292  bs: List<&2, Char>,
2293  +ca: Char,
2294  +pa: Maybe<&2, Char>,
2295  pb: Maybe<&2, Char>,
2296  left: Nat,
2297  +ps: List<&2, Nat>,
2298  +qs: List<&2, Nat>
2299) -> List<&2, Nat>:
2300  match bs:
2301    case Nil{}:
2302      []
2303    case Con{+cb, bt}:
2304      +rr = osa.cell(osa.swap(pa, pb, ca, cb), osa.head(osa.tail(ps)), left, osa.head(ps),
2305        Bool.pick(Nat, Char.is_eq(ca, cb), 0n, 1n), osa.head(qs))
2306      rr <> osa.row(bt, ca, pa, Some{cb}, rr, osa.tail(ps), osa.tail(qs))

Uses (10)

Used by (1)