Sha256: 7b5dc81eb6b0ad983f434f909b37f607736693739f38eab8a0835282c9b73c8b

Contents?: true

Size: 578 Bytes

Versions: 68

Compression:

Stored size: 578 Bytes

Contents

open Base

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

68 entries across 68 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.138 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.137 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.136 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.135 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.134 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.133 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.132 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.131 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.130 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.129 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.128 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.127 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.126 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.125 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.124 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.123 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.122 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.121 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.120 tracks/ocaml/exercises/space-age/example.ml