Source/Packages

Std.List

packages/foundation/standard/src/Std/List.alpha

317 lines21 declarations13.5 KiBSHA-256 0d04bb5f90d2

def · lines 171–196

stdListZipWith

Full file
Combine two lists position by position, keeping their order; the result is as long as the SHORTER list (the rest of the longer one is dropped -- callers that need equal lengths must establish them). The left list is eliminated into a function of the right one, so both spines are walked together.
171def stdListZipWith =
172  (lambda erased left : Type 0 .
173    erased right : Type 0 .
174    erased result : Type 0 .
175    unrestricted combine : (pi unrestricted l : left . unrestricted r : right . result) .
176    unrestricted lefts : (family StdList left) .
177    unrestricted rights : (family StdList right) .
178    app
179      (eliminate
180        StdList
181        (lambda unrestricted current : (family StdList left) .
182          pi unrestricted others : (family StdList right) . family StdList result)
183        lefts
184        (branch StdListEmpty .
185          lambda unrestricted others : (family StdList right) .
186          constructor StdList StdListEmpty result)
187        (branch StdListCons head tail induction .
188          lambda unrestricted others : (family StdList right) .
189          eliminate
190            StdList
191            (lambda unrestricted inner : (family StdList right) . family StdList result)
192            others
193            (branch StdListEmpty . constructor StdList StdListEmpty result)
194            (branch StdListCons otherHead otherTail otherInduction .
195              constructor StdList StdListCons result (combine head otherHead) (induction otherTail))))
196      rights)

The compiler supplied declaration spans and resolved links from this source snapshot. This page does not assert that this file belongs to a checked closure.