DEV Community

Discussion on: Daily Challenge #249 - Incremental Changes

Collapse
 
not_jffrydsr profile image
@nobody

Clojure - Level 1 🌟

(ns dailyChallenge.IncrementalChange249
  (^:level1))

;; algebraic function
(defn algo [number, step, iterations]
  {:pre (>= iterations 1)}
    (+ number (* step iterations)))

(deftest test-algo
  (is (= 52 (algo 2 5 10))
  (is (= 35 (algo 17, 3, 6)))

(run-tests 'test-algo)