hi, --any function foldr myAny'' :: (a-> Bool) -> [a] -> Bool myAny'' f = foldr (\a b -> f a || b) False this is the foldr notions. How would i make this point free? best,
The better question is why would you want to? If you could even manage, the result would be practically incomprehensible. On Wed, Jun 10, 2020 at 07:49 Alexander Chen <alexander@chenjia.nl> wrote:
hi,
--any function foldr myAny'' :: (a-> Bool) -> [a] -> Bool myAny'' f = foldr (\a b -> f a || b) False
this is the foldr notions. How would i make this point free?
best, _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
Hi Alexander, I found this tool online[1], that converts your function to a point free style. myAny'' f = foldr (\a b -> f a || b) False is transformed to myAny'' = flip foldr False . ((||) .) Again as Bob mentions, the point free style comes at a cost of unreadability and hence unmaintainable. Cheers! Apoorv [1]: http://pointfree.io/ <http://pointfree.io/>
On Jun 10, 2020, at 10:00, Bob Ippolito <bob@redivi.com> wrote:
The better question is why would you want to? If you could even manage, the result would be practically incomprehensible.
On Wed, Jun 10, 2020 at 07:49 Alexander Chen <alexander@chenjia.nl <mailto:alexander@chenjia.nl>> wrote: hi,
--any function foldr myAny'' :: (a-> Bool) -> [a] -> Bool myAny'' f = foldr (\a b -> f a || b) False
this is the foldr notions. How would i make this point free?
best, _______________________________________________ Beginners mailing list Beginners@haskell.org <mailto:Beginners@haskell.org> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners <http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners> _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
participants (3)
-
Alexander Chen -
Apoorv Ingle -
Bob Ippolito