Skip to content

Instantly share code, notes, and snippets.

@iambowen
Last active December 21, 2015 22:42
Show Gist options
  • Save iambowen/6376158 to your computer and use it in GitHub Desktop.
Save iambowen/6376158 to your computer and use it in GitHub Desktop.
Clojure implementation
(print (map (fn [a] (/ a 2)) (filter even? (range 1 11))))
@johnelf
Copy link

johnelf commented Aug 29, 2013

   (map (fn [x] (/ x 2)) (filter even? (range 1 11)))

@jcouyang
Copy link

(take 5 (for [x (iterate inc 1) :when (zero? (rem x 2))] (/ x 2)))

@XuefengWu
Copy link

(map (fn [x] (/ x 2)) (filter even? (range 1 11)))

(take 5 (map (fn [x] (/ x 2)) (filter even? (iterate inc 1))))

@zhywang
Copy link

zhywang commented Aug 29, 2013

#!/usr/bin/env clj
(println (map #(/ %1 2)  (filter even? (range 10))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment