Skip to content

Instantly share code, notes, and snippets.

@palladin
Created January 9, 2012 16:22
Show Gist options
  • Save palladin/1583661 to your computer and use it in GitHub Desktop.
Save palladin/1583661 to your computer and use it in GitHub Desktop.
n-ary Seq.map
let (<*>) fs xs = Seq.map2 (fun f x -> f x) fs xs
let map3 f xs bs cs = Seq.map2 f xs bs <*> cs
let map4 f xs bs cs ds = map3 f xs bs cs <*> ds
map4 (fun x b c d -> x + b + c + d) [1;2] [1;2] [1;2] [1;2] // [4; 8]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment