streams

Run Settings
LanguageClojure
Language Version
Run Command
(defn forever [value] (list value (fn [] (forever value)))) (defn stream-map [f stream] (list (f (first stream)) (fn [] (stream-map f ((last stream)))))) (defn stream-take [n stream] (if (= n 0) '() (cons (first stream) (stream-take (dec n) ((last stream)))))) (println (stream-take 10 (stream-map inc (forever 42))))
Editor Settings
Theme
Key bindings
Full width
Lines