query
On this page

imap

lib.misc.imap

Docs pulled from | This Revision | 8 minutes 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);