Re:A difference between Haskell and Common Lisp
by fnordsensei on Monday December 21, 2015 @09:41AM
(#10771227)
Is
An anonymous function call in Haskell? I don't know the language (although it's on my to-learn sequence).
[ Parent
| on HN ]
Re:A difference between Haskell and Common Lisp
by marcosdumay on Monday December 21, 2015 @11:56AM
(#10771996)
Yes. It's three anonymous ("take 5", "filter p" and "drop 3") functions composed by the "." operator, creating another anonymous function.
One of the types, for example:
take :: Int -> [a] -> [a]
What means a function that takes an Int argument and returns another function, that takes a list and returns a list of the same type.
Re:A difference between Haskell and Common Lisp
by mietek on Monday December 21, 2015 @10:33AM
(#10771505)
Yes, written in pointless style. You could make it less pointless by replacing the (.)s with a point.
\xs -> take 5 (filter p (drop 3 xs))
https://wiki.haskell.org/Pointfree
Re:A difference between Haskell and Common Lisp
by catnaroek on Monday December 21, 2015 @09:42AM
(#10771241)
It's an anonymous function, which it not being called.
[deleted]
Re:A difference between Haskell and Common Lisp
by catnaroek on Monday December 21, 2015 @11:10AM
(#10771705)
You probably meant to reply to mietek.
Re:A difference between Haskell and Common Lisp
by pja on Monday December 21, 2015 @12:04PM
(#10772046)
ghci will (usually) tell you:
phil@arod:~$ ghci
GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> :t take 5 . filter (\ _ -> True) . drop 3
take 5 . filter (\ _ -> True) . drop 3 :: [a] -> [a]
So it’s a function from List of a to List of a