Clojure short and simple
(ns daily-challenge.one-ninety-four) (defn spreadNumber [n] ;; precondition check to bound domain {:pre [(> 0 n)]} (unless (= n 1) (vec (range 1 n)) [1]))
and some tests...
(deftest one-ninety-four (is (= [1 2 3] (spreadNumber 3))) (is (= [1 2 3 4 5 6] (spreadNumber 6))) (is (= [1 2 3 4 5 6 7 8 9] (spreadNumber 9)))) (run-tests 'daily-challenge.one-ninety-four) => Testing daily-challenge.one-ninety-four Ran 1 tests containing 3 assertions. 0 failures, 0 errors. {:type :summary, :test 1, :pass 3, :fail 0, :error 0}
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Clojure short and simple
and some tests...