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. Re: Unpacking tuples (Frerich Raabe) 2. Re: Unpacking tuples (mrx) ---------------------------------------------------------------------- Message: 1 Date: Mon, 04 Dec 2017 20:24:12 +0100 From: Frerich Raabe <ra...@froglogic.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] Unpacking tuples Message-ID: <91db987b7037b5ecacb0be1b0a81f...@froglogic.com> Content-Type: text/plain; charset=US-ASCII; format=flowed On 2017-12-04 20:05, mrx wrote: > 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? There are functions like 'curry3' ( http://hackage.haskell.org/package/utility-ht-0.0.14/docs/Data-Tuple-HT.html#v:curry3 ) but I think if you don't need this very often, it might be easiest to just go for let (a,b,c) = f x in g a b c -- Frerich Raabe - ra...@froglogic.com www.froglogic.com - Multi-Platform GUI Testing ------------------------------ Message: 2 Date: Mon, 4 Dec 2017 21:40:46 +0100 From: mrx <patrik....@gmail.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org> Subject: Re: [Haskell-beginners] Unpacking tuples Message-ID: <canzojbg1vvy5cqzbh6kwzatyvfkwbdhoxfuok479j1gpxkp...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" Den 4 dec 2017 20:25 skrev "Frerich Raabe" <ra...@froglogic.com>: On 2017-12-04 20:05, mrx wrote: > 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? > There are functions like 'curry3' ( http://hackage.haskell.org/pac kage/utility-ht-0.0.14/docs/Data-Tuple-HT.html#v:curry3 ) but I think if you don't need this very often, it might be easiest to just go for let (a,b,c) = f x in g a b c Ok, so in general I would have to write the unpacking myself. Correct? // Patrik -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20171204/ee2ef699/attachment-0001.html> ------------------------------ Subject: Digest Footer _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners ------------------------------ End of Beginners Digest, Vol 114, Issue 4 *****************************************