I was trying to implement the function
every :: (a -> IO Bool) -> [a] -> IO Bool
which was the topic for this question. I tried to do this without explicit recursion. I came up with the following code
every f xs = liftM (all id) $ sequence $ map f xs
My function didn't work since it wasn't lazy (which was required in the question),...
I have this code that I want to make point-free;
(\k t -> chr $ a + flip mod 26 (ord k + ord t -2*a))
How do I do that?
Also are there some general rules for point free style other than "think about this amd come up with something"?
...
I've been playing around with Haskell a fair bit, including practising writing functions in point-free form. Here is an example function:
dotProduct :: (Num a) => [a] -> [a] -> a
dotProduct xs ys = sum (zipWith (*) xs ys)
I would like to write this function in point-free form. Here is an example I found elsewhere:
dotProduct = (sum ....
I have been learning the Factor and J languages to experiment with point-free programming. The basic mechanics of the languages seem clear, but getting a feeling for how to approach algorithm design is a challenge.
A particular source of confusion for me is how one should structure code so that it is easy to experiment with different pa...