Send Beginners mailing list submissions to
        beginners@haskell.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  MaximumBy (Alexander Chen)
   2. Re:  MaximumBy (Daniel van de Ghinste (Lord_Luvat))
   3. Re:  MaximumBy (Alexander Chen)
   4. Re:  Understanding types and constructors more    thoroughly
      (Magnus Therning)
   5. Re:  MaximumBy (Francesco Ariis)
   6. Re:  MaximumBy (Ut Primum)


----------------------------------------------------------------------

Message: 1
Date: Fri, 22 May 2020 20:20:38 +0200 (CEST)
From: Alexander Chen <alexan...@chenjia.nl>
To: beginners@haskell.org
Subject: [Haskell-beginners] MaximumBy
Message-ID: <746561064.19225.1590171638...@ichabod.co-bxl>
Content-Type: text/plain; charset="utf-8"

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,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20200522/7b1cdb0d/attachment-0001.html>

------------------------------

Message: 2
Date: Fri, 22 May 2020 20:33:33 +0200
From: "Daniel van de Ghinste (Lord_Luvat)"
        <danielvandeghin...@gmail.com>
To: Alexander Chen <alexan...@chenjia.nl>, The Haskell-Beginners
        Mailing List - Discussion of primarily beginner-level topics related
        to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] MaximumBy
Message-ID: <95b07d1e-14b7-46c1-9764-15d624f78...@gmail.com>
Content-Type: text/plain; charset="utf-8"

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 <alexan...@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@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/f31e65e2/attachment-0001.html>

------------------------------

Message: 3
Date: Fri, 22 May 2020 20:52:03 +0200 (CEST)
From: Alexander Chen <alexan...@chenjia.nl>
To: "Daniel van de Ghinste (Lord_Luvat)"
        <danielvandeghin...@gmail.com>, The Haskell-Beginners Mailing List -
        Discussion of primarily beginner-level topics related to Haskell
        <beginners@haskell.org>
Subject: Re: [Haskell-beginners] MaximumBy
Message-ID: <1715418034.21133.1590173523...@ichabod.co-bxl>
Content-Type: text/plain; charset="utf-8"

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)" 
<danielvandeghin...@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 <alexan...@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@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-0001.html>

------------------------------

Message: 4
Date: Fri, 22 May 2020 21:02:09 +0200
From: Magnus Therning <mag...@therning.org>
To: beginners@haskell.org
Subject: Re: [Haskell-beginners] Understanding types and constructors
        more    thoroughly
Message-ID: <87h7w74wum....@therning.org>
Content-Type: text/plain; charset="utf-8"


Josh Diamond <evild...@live.co.uk> writes:

> Actually I worked it out, no need for any help so please ignore

Please consider writing how you solved it.

Sometimes when searching the internet I come upon questions that the
questioner then solve on her/his own, but _I_ don't get to see the
solution. It robs me of an answer to my question, and the questioner is
robbed of feedback and further insights.

/M

--
Magnus Therning              OpenPGP: 0x927912051716CE39
email: mag...@therning.org
twitter: magthe              http://magnus.therning.org/

You can't depend on your judgement when your imagination is out of focus.
     — Mark Twain
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20200522/f0972d2d/attachment-0001.sig>

------------------------------

Message: 5
Date: Fri, 22 May 2020 21:10:43 +0200
From: Francesco Ariis <fa...@ariis.it>
To: beginners@haskell.org
Subject: Re: [Haskell-beginners] MaximumBy
Message-ID: <20200522191043.GA14834@extensa>
Content-Type: text/plain; charset=iso-8859-1

Hello Alexander,

Il 22 maggio 2020 alle 20:20 Alexander Chen ha scritto:
> 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? 

Do you know how to use foldr and friends?


------------------------------

Message: 6
Date: Fri, 22 May 2020 21:13:49 +0200
From: Ut Primum <utpri...@gmail.com>
To: Alexander Chen <alexan...@chenjia.nl>,  The Haskell-Beginners
        Mailing List - Discussion of primarily beginner-level topics related
        to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] MaximumBy
Message-ID:
        <canjdmkjw6avdurgsq5x4eq-rciavtwdzrjnotxlcbfb3k1c...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hi,
if it is ok for you to work only with lists (not generic foldables), you
could write it this way:

maximumBy cmp [x] = x
maximumBy cmp (x:y:xs) = if (cmp x y)==GT then maximumBy cmp (x:xs) else
maximumBy cmp (y:xs)

the signature is
maximumBy :: (a -> a -> Ordering) -> [a] -> a

Ut



<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Mail
priva di virus. www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#m_-9203042563784922724_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

Il giorno ven 22 mag 2020 alle ore 20:53 Alexander Chen <
alexan...@chenjia.nl> ha scritto:

> 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)" <
> danielvandeghin...@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 <alexan...@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@haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>

<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Mail
priva di virus. www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20200522/f3157098/attachment.html>

------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 143, Issue 10
******************************************

Reply via email to