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


Groups > comp.lang.haskell > #330

Re:Lists

From Norbert Melzer <timmelzer@gmail.com>
Newsgroups comp.lang.haskell
Subject Re:Lists
Date 2015-07-22 16:59 +0200
Organization news.individual.net
Message-ID <d19pf2FmhdkU1@mid.individual.net> (permalink)
References <81e2b7cb-fa2c-4d0e-8dca-a9f33a114ef9@googlegroups.com>

Show all headers | View raw


pip7kids@gmail.com Wrote in message:
> 
> Hi
> I was playing with the following example and was wondering how I could get to pass lists of weights and heights into the following code.
> 
> calcBmis2 :: [(Double ,Double)] -> [Double]
> calcBmis2 xs = [bmi | (w , h) <- xs, let bmi = w / h ^ 2, bmi > 25]
> 
> main = do 
>   print(calcBmis2[(81.5,1.8)]) -- this works fine 
> [25.15432098765432]
> .........................................................
> 
> However, rather than just use 2 variables (w for weight and h for height) - how can I pass multiple arguments .
> 
> For example - 
> w = [81.5,77.2]
> h = [1.8.1.99]
> 
> Regards
> 
> 

What you should is simply call calcbmis with a list of tuples. 
-- 


----Android NewsGroup Reader----
http://usenet.sinaapp.com/

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


Thread

Lists pip7kids@gmail.com - 2015-07-22 07:13 -0700
  Re:Lists Norbert Melzer <timmelzer@gmail.com> - 2015-07-22 16:59 +0200
  Re: Lists Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-07-22 16:51 +0100
  Re: Lists philsivyer@googlemail.com - 2015-07-22 12:57 -0700

csiph-web