Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
let (++) f g x = f (g x) in let f x = x + 1 in let g x = x * 2 in (f++g) 1;;
f++g x = 2 * x + 1
您对函数组合的实现是正确的,因为:
(g ∘ f)(x) = g(f(x)) 对于 X 中的所有 x
根据维基百科
我得到:
- : int = 3
在 ocamlktop