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.110 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.109 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.108 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.107 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.106 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.105 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.104 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.103 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.102 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.101 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.100 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.99 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.98 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.97 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.96 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.95 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.94 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.93 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.92 tracks/ocaml/exercises/space-age/example.ml
trackler-2.2.1.91 tracks/ocaml/exercises/space-age/example.ml