[ create a new paste ] login | about

Link: http://codepad.org/nIz9DRYA    [ raw code | output | fork ]

Haskell, pasted on Nov 29:
module SpaceAge (Planet(..), ageOn) where

data Planet = Mercury
            | Venus
            | Earth
            | Mars
            | Jupiter
            | Saturn
            | Uranus
            | Neptune
            deriving (Show, Eq)

ageOn :: Planet -> Float -> Float
ageOn planet seconds 
  | planet == Mercury = 0.2408467 * earthAge
  | planet == Venus = 0.61519726 * earthAge
  | planet == Earth = seconds * 31557600
  | planet == Mars = 1.8808158 * earthAge
  | planet == Jupiter = 11.862615 * earthAge
  | planet == Saturn = 29.447498 * earthAge
  | planet == Uranus = 84.016846 * earthAge
  | planet == Neptune = 164.79132 * earthAge
  where earthAge = ageOn Earth seconds


Output:
1
runhugs: can't find "Main" module


Create a new paste based on this one


Comments: