query
On this page

zipListsWith

lib.lists.zipListsWith

Docs pulled from | This Revision | 11 minutes ago


Merges two lists of the same size together. If the sizes aren't the same the merging stops at the shortest. How both lists are merged is defined by the first argument.

Inputs

f

Function to zip elements of both lists

fst

First list

snd

Second list

Type

zipListsWith :: (a -> b -> c) -> [a] -> [b] -> [c]

Examples

lib.lists.zipListsWith usage example

zipListsWith (a: b: a + b) ["h" "l"] ["e" "o"]
=> ["he" "lo"]

Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

zipListsWith =
    f:
    fst:
    snd:
    genList
      (n: f (elemAt fst n) (elemAt snd n)) (min (length fst) (length snd));