query
On this page

imap0

lib.lists.imap0

Docs pulled from | This Revision | about 1 hour ago


Map with index starting from 0

Inputs

f

1. Function argument

list

2. Function argument

Type

imap0 :: (int -> a -> b) -> [a] -> [b]

Examples

lib.lists.imap0 usage example

imap0 (i: v: "${v}-${toString i}") ["a" "b"]
=> [ "a-0" "b-1" ]

Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

imap0 = f: list: genList (n: f n (elemAt list n)) (length list);