Search Results

Search found 1 results on 1 pages for 'user364996'.

Page 1/1 | 1 

  • Body Mass Index program in haskell

    - by user364996
    Hi there. I'm trying to write a simple program in Haskell that can determine someone's body mass index. Here's what I have written: type Height = Float type Weight = Float type PeopleStats = [(String, Height, Weight)] and... bmi :: Height -> Weight -> Float bmi heightCm weightKg = weightKg/(heightCm)^2 healthy :: Height -> Weight -> Bool healthy heightCm weightKg | 25 > index && 18 < index = True | otherwise = False where index = bmi heightCm weightKg So far, the function "healthy" can calculate someone's BMI, and the function "healthyPeople" returns a boolean statement determining if the person's BMI falls within the limits which is considered normal for a healthy person. I want to write a function called "healthyPeople". healthyPeople :: PeopleStats -> [String] This function needs to take a list of PeopleStats and returns a list of names (Strings) of people who are deemed to be "healthy" from the "healthy" function. For example: If I input [("Lee", 65, 185), ("Wang", 170, 100), ("Tsu", 160, 120)] I will get a list of the names of the people whose BMI returns true form the boolean function in "healthy". Please help !!!!

    Read the article

1