Czy Scala ma operatora podobnego do Haskell's $
?
-- | Application operator. This operator is redundant, since ordinary
-- application @(f x)@ means the same as @(f '$' x)@. However, '$' has
-- low, right-associative binding precedence, so it sometimes allows
-- parentheses to be omitted; for example:
--
-- > f $ g $ h x = f (g (h x))
--
-- It is also useful in higher-order situations, such as @'map' ('$' 0) [email protected],
-- or @'Data.List.zipWith' ('$') fs [email protected]
{-# INLINE ($) #-}
($) :: (a -> b) -> a -> b
f $ x = f x
W trosce o samo pytanie, byłoby miło, gdybyś wyjaśnił, co to jest/robi konstrukt Haskella. –
$ jest najwyraźniej prawostronny i ma niski priorytet http://learnyouahaskell.com/higher-order-functions#function-application. – huynhjl