ml - What does float->float mean in OCaml? -
i have type, defines expression. know * symbol lets me add pairs, -> for?
# type expression = value of float | sum of (expr*expr) | subtraction of (expr*expr) | fc1 of ((float->float)*expr)
the -> operator function types. a -> b means "a in, b out", float -> float type of functions take float argument , produce float result.
what
float -> float -> float
-> right-associative, a -> b -> c same a -> (b -> c) meaning function takes a , produces function of type b -> c. functions used simulate multi-arguments functions (you can use f x y apply f x , apply resulting function y, calls inner function 2 arguments) alternative tuples. way of simulating multi-argument functions called currying.
Comments
Post a Comment