Charles Babbage's Difference Engine for Clojure.
An (arguably more fun) alternative to range
, infer
returns a lazy sequence of zeroes of the least degree polynomial function inferred from the given pattern.
Here's a short history of its evolution.
[difference-engine "0.1.0-SNAPSHOT"]
(require '[difference-engine.core :refer [infer]])
(infer [1 2]) ;=> (1 2 3 4 5 ...)
(infer [100 90]) ;=> (100 90 80 70 60 ...)
(infer [1 4 9]) ;=> (1 4 9 16 25 ...)
(infer 5 [20 15]) ;=> (20 15 10 5 0)
Distributed under the Eclipse Public License.