I really wish that Google was better at searching for syntax:
decades :: (RealFrac a) => a -> a -> [a] -> Array Int Int
decades a b = hist (0,9) . map decade
where decade x = floor ((x - a) * s)
s = 10 / (b - a)
f(g(x))
is
in mathematics : f ∘ g
(x)
in haskell : ( f . g )
(x)
It means function composition. See this question.
Note also the f.g.h x
is not equivalent to (f.g.h) x
, because it is interpreted as f.g.(h x)
which won't typecheck unless (h x) returns a function.
This is where the $ operator can come in handy: f.g.h $ x
turns x from being a parameter to h
to being a parameter to the whole expression. And so it becomes equivalent to f(g(h x))
and the pipe works again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With