learning F#, it seems pretty cool, favourite functional language so far.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

Darts.fs 366B

123456789101112131415
  1. module Darts
  2. let withinCircle (radius: int) (x: double) (y: double) =
  3. sqrt ((pown x 2) + (pown y 2)) <= double(radius)
  4. let score (x: double) (y: double): int =
  5. if withinCircle 10 x y then
  6. if withinCircle 5 x y then
  7. if withinCircle 1 x y then
  8. 10
  9. else
  10. 5
  11. else
  12. 1
  13. else 0