Send Beginners mailing list submissions to
[email protected]
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
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. "Shortcut" for f (g x) (g x) (Baa)
2. Re: "Shortcut" for f (g x) (g x) (Dániel Arató)
3. Re: "Shortcut" for f (g x) (g x) (Mihai Maruseac)
4. Re: "Shortcut" for f (g x) (g x) (Baa)
5. Re: "Shortcut" for f (g x) (g x) (Jeffrey Brown)
6. Unpacking tuples (mrx)
----------------------------------------------------------------------
Message: 1
Date: Mon, 4 Dec 2017 18:31:02 +0200
From: Baa <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: [Haskell-beginners] "Shortcut" for f (g x) (g x)
Message-ID: <20171204183102.23c72c74@Pavel>
Content-Type: text/plain; charset=US-ASCII
Hello, All!
Does Haskell have some "short-form" for such call: `f (g x) (g x)`, for
example:
compare (snd x) (snd x)
Looks like combinatory logic or `ap` but not exactly...
===
Best regards, Paul
------------------------------
Message: 2
Date: Mon, 4 Dec 2017 17:34:45 +0100
From: Dániel Arató <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] "Shortcut" for f (g x) (g x)
Message-ID:
<CAHvKd2LAzHToZAEQKpNAJ7qJurRh4bExL58sVeboEgeW-0c=n...@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"
Hi!
I think you're looking for Data.Function.on:
http://hackage.haskell.org/package/base-4.10.0.0/docs/Data-Function.html#v:on
On 04/12/2017, Baa <[email protected]> wrote:
> Hello, All!
>
> Does Haskell have some "short-form" for such call: `f (g x) (g x)`, for
> example:
>
> compare (snd x) (snd x)
>
> Looks like combinatory logic or `ap` but not exactly...
>
> ===
> Best regards, Paul
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
------------------------------
Message: 3
Date: Mon, 4 Dec 2017 08:34:26 -0800
From: Mihai Maruseac <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] "Shortcut" for f (g x) (g x)
Message-ID:
<caomsumj0bo9fzdtvpzz06d2mmeed94tyr47vujblny5-toy...@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"
You can use `liftM2 f g g`
For the example you mentioned, there's also
compare `on` snd
or
comparing snd
with the proper imports (Data.Ord, Data.Function)
On Mon, Dec 4, 2017 at 8:31 AM, Baa <[email protected]> wrote:
> Hello, All!
>
> Does Haskell have some "short-form" for such call: `f (g x) (g x)`, for
> example:
>
> compare (snd x) (snd x)
>
> Looks like combinatory logic or `ap` but not exactly...
>
> ===
> Best regards, Paul
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
--
Mihai Maruseac (MM)
"If you can't solve a problem, then there's an easier problem you can
solve: find it." -- George Polya
------------------------------
Message: 4
Date: Mon, 4 Dec 2017 18:51:31 +0200
From: Baa <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] "Shortcut" for f (g x) (g x)
Message-ID: <20171204185131.6e27528a@Pavel>
Content-Type: text/plain; charset=US-ASCII
Oh, yes! Exactly, thanks to all!!
> Hi!
>
> I think you're looking for Data.Function.on:
> http://hackage.haskell.org/package/base-4.10.0.0/docs/Data-Function.html#v:on
>
> On 04/12/2017, Baa <[email protected]> wrote:
> > Hello, All!
> >
> > Does Haskell have some "short-form" for such call: `f (g x) (g x)`,
> > for example:
> >
> > compare (snd x) (snd x)
> >
> > Looks like combinatory logic or `ap` but not exactly...
> >
> > ===
> > Best regards, Paul
> > _______________________________________________
> > Beginners mailing list
> > [email protected]
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
> >
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
Message: 5
Date: Mon, 4 Dec 2017 12:31:40 -0500
From: Jeffrey Brown <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] "Shortcut" for f (g x) (g x)
Message-ID:
<caec4ma0t8kw4uji2ubnpaa2uhoqghbupaavxye-zguu0sgr...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
This led me to look up the definition of on
<http://hackage.haskell.org/package/base-4.10.0.0/docs/src/Data.Function.html#on>
and
discover that punctuation can be used as a variable name for an operator!
On Mon, Dec 4, 2017 at 11:51 AM, Baa <[email protected]> wrote:
> Oh, yes! Exactly, thanks to all!!
>
> > Hi!
> >
> > I think you're looking for Data.Function.on:
> > http://hackage.haskell.org/package/base-4.10.0.0/docs/
> Data-Function.html#v:on
> >
> > On 04/12/2017, Baa <[email protected]> wrote:
> > > Hello, All!
> > >
> > > Does Haskell have some "short-form" for such call: `f (g x) (g x)`,
> > > for example:
> > >
> > > compare (snd x) (snd x)
> > >
> > > Looks like combinatory logic or `ap` but not exactly...
> > >
> > > ===
> > > Best regards, Paul
> > > _______________________________________________
> > > Beginners mailing list
> > > [email protected]
> > > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
> > >
> > _______________________________________________
> > Beginners mailing list
> > [email protected]
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
--
Jeff Brown | Jeffrey Benjamin Brown
Website <https://msu.edu/~brown202/> | Facebook
<https://www.facebook.com/mejeff.younotjeff> | LinkedIn
<https://www.linkedin.com/in/jeffreybenjaminbrown>(spammy, so I often miss
messages here) | Github <https://github.com/jeffreybenjaminbrown>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20171204/9a3f5a5f/attachment-0001.html>
------------------------------
Message: 6
Date: Mon, 4 Dec 2017 20:05:05 +0100
From: mrx <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Subject: [Haskell-beginners] Unpacking tuples
Message-ID:
<canzojbg82zupwemsx8fqh7xdsfy+sygqs7+0ooaqzd41idb...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Hi,
If I have a function that produce tuples with three members and I want
those members as parameters for a function that takes three parameters. How
would I unpack that tuple?
It seems that curry does the trick for tuples with two members.
How do I do this when there are more than two members?
Patrik
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://mail.haskell.org/pipermail/beginners/attachments/20171204/ccc8eb11/attachment.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 114, Issue 3
*****************************************