Apply list of functions to list of arguments, one-to-one


/ Published in: Haskell
Save to your folder(s)

Easy if you know how... ;)


Copy this code and paste it in your HTML
  1. zid :: [a -> b] -> [a] -> [b]
  2. zid = zipWith id
  3. -- zipWith ($) also works
  4.  
  5. -- example usage:
  6. fs = map (*) [1..5]
  7. xs = reverse [2..6]
  8. ys = zid fs xs
  9. -- ys is [6,10,12,12,10]

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.