[Haskell-beginners] MaximumBy
Alexander Chen
alexander at chenjia.nl
Fri May 22 18:52:03 UTC 2020
Hi,
maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
its in the Data.List
May 22, 2020 8:33:33 PM CEST "Daniel van de Ghinste (Lord_Luvat)" <danielvandeghinste at gmail.com> wrote:Hi,
Maybe I’m on a different version, but I don’t see a function called maximumBy in my base Prelude. Can you give us a type signature for the function? If you’re not sure how to do that just type:
Prelude> :t maximumBy
In your ghci interpreter and it should return the type signature of whatever you have after ‘:t ‘ (this works for compound expressions too if you put them in brackets)
Perhaps maximumBy is what you’re meant to call your rewrite of the existing function I see called ‘maximum’ (seems to do the same thing). Let me know if thats the case and I can explain how it works.
Best regards,
Daniel van de Ghinste
On 22 May 2020, at 20:20, Alexander Chen <alexander at chenjia.nl> wrote:
Hi,
I want to re-write a function maximumBy (its an assignment).
However, I don't get how it works.
>maximumBy compare [1,53,9001, 10]
9001
but what does it actually do to get there?
thanks in advance.
best,
_______________________________________________
Beginners mailing list
Beginners at haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20200522/3da57ad9/attachment.html>
More information about the Beginners
mailing list