This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defproject rss-feeder "1.0.0-SNAPSHOT" | |
:description "RSS Feeder - Filters RSS feed for given keywords" | |
:dependencies [[org.clojure/clojure "1.2.0"] | |
[org.clojure/clojure-contrib "1.2.0"] | |
[clj-http "0.1.2"]] | |
:main rss.core) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;http://4clojure.com/problem/22 | |
;count without using count | |
(#(loop [myseq % i 0] | |
(if (empty? myseq) | |
i | |
(recur (next myseq) (+ i 1)))) | |
[1 2 3 4]) ; or provide any list arg here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(fn [xs n] (if (= n 1) xs (apply interleave (repeat n xs)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(fn [xs1 xs2] (flatten (reverse (seq (zipmap xs1 xs2))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(fn [k xs] (conj (vec (interleave xs (vec (repeat ( - (count xs) 1) k)))) (last xs))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(fn [xs n] (keep-indexed (fn [idx v] (if (zero? (mod (+ idx 1) n)) nil v)) xs)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn fct [n] (if (= n 1) 1 (reduce #(* %1 %2) (range 1 (+ n 1))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
((partial (fn [fns x y] (fns y x)) nth) 2 [1 2 3]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn rotate [n xs] | |
(let [cnt (count xs) | |
modn (mod n cnt)] | |
(flatten (list (take-last (- cnt modn) xs) (take modn xs))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(fn [xs] | |
(let [m (group-by (fn [x] x) xs)] | |
(zipmap (keys m) (map count (vals m))))) |
OlderNewer