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 foo [bar] (:baz bar)) |
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 converging-seq | |
"Generates a sequence with terminates when two successive elements | |
from coll are identical. | |
(converged-seq [1 2 3 4 4 5 6]) => [1 2 3 4]" | |
[coll] | |
(cons | |
(first coll) | |
(map second | |
(take-while (fn [[prev curr]] (not (= prev curr))) | |
(partition 2 1 coll))))) |
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 converging-seq | |
[coll] | |
(for [[x y] (partition 2 1 (cons ::not-an-element coll)) :while (not (= x y))] y)) | |
(defn converging-seq2 | |
[[x y & tl]] | |
(cond (nil? x) [] | |
(nil? y) [x] | |
(= x y) [x] | |
:else (lazy-seq (cons x (converging-seq2 (cons y tl)))))) |
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
(todo | |
"I'm not sure this function looks as nice as it could" | |
(defn converging-seq | |
"Generates a sequence with terminates when two succent elements | |
from coll are identical. | |
(converged-seq [1 2 3 4 4 5 6]) => [1 2 3 4]" | |
[coll] | |
(cons | |
(first coll) | |
(map second |
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
(def todo-log (ref [])) | |
(defn save-code-and-snippet [comment code-str] | |
(dosync (alter todo-log conj [comment code-str]))) | |
(defmacro todo | |
[comment form] | |
(do | |
(save-code-and-snippet comment (str form)) | |
form)) |
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
(defmacro todo | |
"Annotates a form with a comment for later review. | |
Adds the comment and the form to the batch of todos, which | |
can be revied later using todo-summary." | |
[comment & more] | |
(do | |
(save-code-and-snippet comment (apply | |
#(with-out-str pprint %) more)) | |
`(do ~@more))) |
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
(ns penumbra-fail | |
(:use [penumbra opengl]) | |
(:require [penumbra.app :as app] | |
[penumbra.text :as text])) | |
(defn display [[delta time] state] | |
(text/write-to-screen "hello world" 0 0)) | |
(defn view-text [& args] | |
(app/start {:display display} {})) |
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 penumbra-fail "1.0.0-SNAPSHOT" | |
:description "FIXME: write" | |
:dependencies [[org.clojure/clojure "1.1.0"] | |
[org.clojure/clojure-contrib "1.1.0"] | |
[penumbra "0.5.0"]] | |
:native-dependencies [[lwjgl "2.2.2"]] | |
:dev-dependencies [[lein-run "1.0.0-SNAPSHOT"] | |
[native-deps "1.0.0"]]) |
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
(ns penumbra-fail | |
(:use [penumbra opengl]) | |
(:require [penumbra.app :as app] | |
[penumbra.text :as text])) | |
(defn init [state] | |
(enable :blend) | |
state) | |
(defn display [[delta time] state] |
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 testing "1.0.0-SNAPSHOT" | |
:description "FIXME: write" | |
:dependencies [[org.clojure/clojure "1.2.0-master-SNAPSHOT"] | |
[org.clojure/clojure-contrib "1.2.0-SNAPSHOT"] | |
[penumbra "0.6.0-SNAPSHOT"]] | |
:native-dependencies [[penumbra/lwjgl "2.4.2"]] | |
:dev-dependencies [[native-deps "1.0.0"]]) |
OlderNewer