Just because Exercism doesn’t offer your favorite language as an official track, it doesn’t mean we can’t play at all. Post some solutions to the weekly challenges in the language of your choice!

  • AndyOPM
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    6 months ago
    Space Age
    USING: assocs calendar math math.extras ;
    
    CONSTANT: year-factors H{
      { "Mercury"   0.2408467  }
      { "Venus"     0.61519726 }
      { "Earth"     1.0        }
      { "Mars"      1.8808158  }
      { "Jupiter"  11.862615   }
      { "Saturn"   29.447498   }
      { "Uranus"   84.016846   }
      { "Neptune" 164.79132    }
    }
    
    : space-age ( seconds planet -- earth-years )
      year-factors at
      years duration>seconds
      /
      2 round-to-decimal ;