Sha256: 3badf41bade9a026cb5c85cc050fc330d2318c61fd2cb5d0a49c47e3d997fe8b

Contents?: true

Size: 578 Bytes

Versions: 151

Compression:

Stored size: 578 Bytes

Contents

open Core

type planet = Mercury | Venus | Earth | Mars
            | Jupiter | Saturn | Neptune | Uranus

let earth_years seconds = seconds /. 31557600.0

let rel_years = function
    | Mercury -> 0.2408467
    | Venus   -> 0.61519726
    | Earth   -> 1.
    | Mars    -> 1.8808158
    | Jupiter -> 11.862615
    | Saturn  -> 29.447498
    | Uranus  -> 84.016846
    | Neptune -> 164.79132

let age_on planet seconds =
    let seconds' = Float.of_int seconds in
    match planet with
    | Earth -> earth_years seconds' 
    | _     -> earth_years seconds' /. rel_years planet

Version data entries

151 entries across 151 versions & 1 rubygems

Version Path
trackler-2.2.1.50 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.49 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.48 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.47 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.46 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.45 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.44 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.43 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.42 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.41 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.40 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.39 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.38 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.37 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.36 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.35 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.34 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.33 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.32 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.31 tracks/ocaml/exercises/space-age/example.ml