Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.haskell > #336

Re: using list comprehension

Newsgroups comp.lang.haskell
Date 2015-07-24 03:45 -0700
References <4641db20-a273-4a84-bbba-9f2b5aeb5bb6@googlegroups.com>
Message-ID <68dd5a82-db30-4e39-b601-95cdc2571aca@googlegroups.com> (permalink)
Subject Re: using list comprehension
From pip7kids@gmail.com

Show all headers | View raw


On Friday, 24 July 2015 10:06:56 UTC+1, pip7...@gmail.com  wrote:
> Hi
> I'm trying to understand if I can use the following code in a list comprehension.
> 
> The following works for 2 values - 456.78 44
> perc = 44.56
> returns nav shares =
>   let aum = nav * shares
>       rets = aum ^ 2
>       val = 1000 / perc
>       rem = aum / rets  + val 
>   in aum / rets * rem ^ 4
> 
> main = do 
>    print(returns 456.78 44) -- result is 12.620116562240828
> 
> .......... however, what I would like to achieve is - can I use the above logic for many values in a list comprehension?
> 
> eg
> 
> nav = [1,2,3,4]
> shares = [5,6,7,8]
> 
> I would now like my "return" function to act on the list's nav and shares.
> Is this possible and how.
> 
> Regards

Thats simply brilliant - thanks

Back to comp.lang.haskell | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

using list comprehension pip7kids@gmail.com - 2015-07-24 02:06 -0700
  Re: using list comprehension Mark Carroll <mtbc@bcs.org> - 2015-07-24 10:58 +0100
  Re: using list comprehension pip7kids@gmail.com - 2015-07-24 03:45 -0700

csiph-web