query
On this page

imap1

lib.imap1

Docs pulled from | This Revision | about 2 hours ago


Map with index starting from 1

Inputs

f

1. Function argument

list

2. Function argument

Type

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

Examples

lib.lists.imap1 usage example

imap1 (i: v: "${v}-${toString i}") ["a" "b"]
=> [ "a-1" "b-2" ]
(lib.lists.imap1)

Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

imap1 = f: list: genList (n: f (n + 1) (elemAt list n)) (length list);