chickadee » srfi-116 » imap

imap proc ilist1 ilist2 ...procedure

proc is a procedure taking as many arguments as there are ilist arguments and returning a single value. imap applies proc element-wise to the elements of the ilists and returns an ilist of the results, in order. The dynamic order in which proc is applied to the elements of the ilists is unspecified.

(imap icadr (iq (a b) (d e) (g h))) ;=>  (b e h)

(imap (lambda (n) (expt n n))
      (iq 1 2 3 4 5))
 ;=>  (1 4 27 256 3125)

(imap + (iq 1 2 3) (iq 4 5 6)) ;=>  (5 7 9)

(let ((count 0))
  (imap (lambda (ignored)
         (set! count (+ count 1))
         count)
       (iq a b))) ;=>  (1 2) or (2 1)