27 Aug 2013

Chicken:

  (require '[clojure.walk :as walk]
           '[clojure.pprint :refer [pprint]]
           '[clojure.string :refer [replace]])

  (defn chicken
    [form]
    (walk/postwalk (fn [x]
                     (cond
                      (= x '&) x
                      (string? x) (replace x
                                           #"\w+"
                                           "chicken")
                      (symbol? x) 'chicken
                      :else x))
                   form))

Chicken chicken:

(pprint
 (chicken
  '(defn alter-map-values
     "Given a map, derive a new one where all the keys are passed through f.
      If f returns nil, the key is unchanged."
     [f m]
     (reduce (fn [altered [k v]]
	       (assoc altered
		 k (or (f v) v)))
	     {}
	     m))))

Chicken, Chicken, Chicken:

(chicken
 chicken
 "chicken chicken chicken, chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken chicken.
  chicken chicken chicken chicken, chicken chicken chicken chicken."
 [chicken chicken]
 (chicken
  (chicken
   [chicken [chicken chicken]]
   (chicken chicken chicken (chicken (chicken chicken) chicken)))
  {}
  chicken))

Chickens:

Chicken

Chicken Chicken

comments powered by Disqus