This file contains 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
;;; Example from compojure rewritten for use with webpub. | |
;;; Look no dependencies! | |
(ns example) | |
(defn html-doc | |
[title & body] | |
[:html | |
[:head | |
[:title title]] |
This file contains 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
(define-class-ai druid | |
(spell moonfire "moonfire") | |
(spell roots "roots") | |
(spell wrath "wrath") | |
(spell mark-of-the-wild "mark of the wild") | |
(spell thorns "thorns") | |
(spell rejuvenate "rejuvenation") | |
(spell regrowth "regrowth") | |
;; Feral | |
(spell dire-bear "dire bear") |
This file contains 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 Y [r] (#(% %) #(r (fn [x] ((% %) x))))) | |
(defn fact-gen [fact-in] | |
(fn [n] | |
(if (= n 0) 1 | |
(* n (fact-in (- n 1)))))) | |
((Y fact-gen) 7) |
This file contains 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
(ns net.cddr.rabbitmq | |
(:import (com.rabbitmq.client Channel Connection ConnectionFactory | |
QueueingConsumer | |
RpcClient StringRpcServer) | |
(com.rabbitmq.tools.jsonrpc JsonRpcServer JsonRpcClient) | |
(com.rabbitmq.examples HelloJsonService))) | |
;; (import '(com.rabbitmq.client Channel Connection ConnectionFactory | |
;; QueueingConsumer |
This file contains 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
;; My take on Fibonacci numbers | |
(defn gen-fibo [] | |
(let [fibo (atom nil)] | |
(reset! fibo (lazy-cat [0 1] (lazy-seq (map + @fibo (rest @fibo))))))) | |
(def fib (proxy [clojure.lang.Seqable] [] | |
(seq [] (gen-fibo)))) | |