### Clojure Golf: fib-seq

unsorted — cgrand, 30 October 2008 @ 0 h 45 min

Revisiting a classic:

```(def fib-seq
(lazy-cat [0 1] (map + fib-seq (rest fib-seq))))
```

### Clojure Golf: subsets-by-card (2)

unsorted — cgrand, 22 October 2008 @ 10 h 14 min

I wasn’t happy with the last one. At least this one is lazier and in increasing cardinality order.

```(defn subsets-by-card [s]
(reduce (fn [ssbc x]
(map (fn [a b] (concat a (map #(conj % x) b)))
(concat ssbc [nil]) (concat [nil] ssbc)))
[[#{}]] s))
```

Decreasing order:

```(defn subsets-by-card-reverse [s]
(reduce (fn [ssbc x]
(map (fn [a b] (concat a (map #(<ins>disj</ins> % x) b)))
(concat ssbc [nil]) (concat [nil] ssbc)))
[[<ins>(set s)</ins>]] s))
```

### Clojure Golf: subsets-by-card

unsorted — cgrand, 20 October 2008 @ 23 h 09 min
```(defn subsets-by-card [s]
(reduce (fn [ssbc x]
(concat
(map (fn [a b] (concat a (map #(conj % x) b)))
(cons nil ssbc) ssbc)
[[#{}]]))
[[#{}]] s))
```

(a tough one)

### Clojure Golf: subsets

unsorted — cgrand, @ 23 h 08 min
```(defn subsets [s]
(reduce (fn [ss x] (concat ss (map #(conj % x) ss))) [#{}] s))
```

### Clojure Golf: combinations (2)

unsorted — cgrand, 19 October 2008 @ 9 h 41 min
```(defn combinations [& cs]
(reduce #(for [v %1 i %2] (conj v i)) [[]] cs))
```

### Clojure Golf: combinations

unsorted — cgrand, 18 October 2008 @ 15 h 53 min
```(defn combinations [& cs]
(reduce (fn [vs c]
(mapcat #(map conj vs (repeat %)) c))
[[]] cs))
```