[Haskell-beginners] Haskell Question

Ut Primum utprimum at gmail.com
Fri Oct 18 16:59:05 UTC 2019


Hi,
this is my solution:

productLastPart :: Int -> [Int] -> Int
productLastPart n xs = product (take n (reverse xs))

It only uses functions product, take and reverse
Regards,
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>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

Il giorno ven 18 ott 2019 alle ore 18:16 Seph Shewell Brockway
<seph at codex.scot> ha scritto:

> On Wed, Oct 16, 2019 at 09:09:40PM +0000, instanct95 at aol.com wrote:
> > I need help with this haskell functionWrite a function productLastPart
> which, only using library functions, returns the product of thelast n
> numbers in the list, where n is the first argument to the
> function. productLastPart :: Int -> [Int] -> Int
>
> It would probably help you learn if you made an attempt to solve it
> yourself first. If you post what you have so far, I’d be happy to take
> a look.
>
>          Regards,
>
>          Seph
>
> --
> Seph Shewell Brockway, BSc MSc (Glas.)
> Pronouns: she/her
> _______________________________________________
> 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/20191018/67029331/attachment.html>


More information about the Beginners mailing list