Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.haskell > #334
| Newsgroups | comp.lang.haskell |
|---|---|
| Date | 2015-07-24 02:06 -0700 |
| Message-ID | <4641db20-a273-4a84-bbba-9f2b5aeb5bb6@googlegroups.com> (permalink) |
| Subject | using list comprehension |
| From | pip7kids@gmail.com |
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
Back to comp.lang.haskell | Previous | Next — Next in thread | Find similar | Unroll 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