çå·®æ°å
ç®æ¨
é
åã®é£æ¥ãã2é
ã«ããããæ¼ç®ãæ½ããé
åãå¾ãããã¤ã¾ãã
f (+) [1,2,3,4,5] = [3,5,7,9]
ã®ãã㪠f ã欲ããã
çµæ
OCaml ã¯ãªã¯ã³ã³ã ã£ã
(ããããã°ãã¾ãæ¸ããããã¨ããã®ãããã°æãã¦ãã ãã)
æç´(Haskell)
f g [] = [] f g [_] = [] f g (x:y:zs) = g x y : f g (y:zs)
Haskell
f g x = zipWith g x (tail x)
F#
let uncurry g (a, b) = g a b let f g x = Seq.map (uncurry g) (Seq.pairwise x)
Ruby(ç¡çãã)
def f(x, &b) x[0..-2].zip(x.drop(1)).map { |y, z| b.call(y, z) } end