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 bktree) | |
(defn root [distance-fn] {:distance-fn distance-fn :children {}}) | |
(defn new-node [term] {:term term :children {}}) | |
(defn insert | |
([element node] | |
(insert element node (:distance-fn node))) | |
([element node distance-fn] |
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 bktree) | |
(defn root [distance-fn] {:distance-fn distance-fn :children {}}) | |
(defn new-node [term] {:term term :children {}}) | |
(defn insert | |
([element node] | |
(insert element node (:distance-fn node))) | |
([element node distance-fn] |
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 bktree) | |
(defn root [distance-fn] {:distance-fn distance-fn :children {}}) | |
(defn new-node [term] {:term term :children {}}) | |
(defn insert | |
([element node] | |
(insert element node (:distance-fn node))) | |
([element node distance-fn] |
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
{:type :context, | |
:doc describe syntax, | |
:tests ({:type :expects, | |
:doc single assertion, | |
:tests ({:type :expect, | |
:expectations [(fn [] (= (+ 1 1) 2))]})})} |
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
(testing "describe syntax" | |
(describe "single assertion" | |
(= (+ 1 1) 2)) | |
(context "many assertions" | |
(describe "plus" | |
(= (+ 1 1) 2) | |
"minus" | |
(= (- 2 1) 1) | |
"divide" |
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 probe) | |
(use 'clojure.contrib.seq-utils) | |
(defmacro property | |
([doc] | |
`(println "Pending - " ~doc)) | |
([doc test] | |
`(if ~test | |
(println "passed! " '~test) |
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
(require ['clojure.contrib.shell-out :as 'shell]) | |
(require ['clojure.contrib.str-utils2 :as 'stru]) | |
(use 'clojure.contrib.seq-utils) | |
; Vorbis comment to mp3 tags functions | |
(defn- vorbis-comments | |
"Retuns a seq of seq containing key/value pairs (('ARTIST' 'foo') ('ALBUM' 'bar')) for a given file name" | |
[file] | |
(let [comments (shell/sh "vorbiscomment" file)] | |
(seq (map #(stru/split % #"=") (stru/split comments #"\n"))))) |
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
(require ['clojure.contrib.shell-out :as 'shell]) | |
(require ['clojure.contrib.str-utils2 :as 'stru]) | |
(use 'clojure.contrib.seq-utils) | |
; Vorbis comment to mp3 tags functions | |
(defn- vorbis-comments | |
"Retuns a seq of seq containing key/value pairs (('ARTIST' 'foo') ('ALBUM' 'bar')) for a given file name" | |
[file] | |
(let [comments (shell/sh "vorbiscomment" file)] | |
(seq (map #(stru/split % #"=") (stru/split comments #"\n"))))) |
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
(require ['clojure.contrib.shell-out :as 'shell]) | |
(def dir (second *command-line-args*)) | |
(defn as-seq [string] (seq (.split string "\n"))) | |
(defn find-by-name [d n] (as-seq (shell/sh "find" "." "-name" n :dir d))) | |
(defn oggs [] (find-by-name dir "*.ogg")) | |
(defn base-name [fname] (.replaceFirst fname "\\..{3}$" "")) |
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
(require ['clojure.contrib.shell-out :as 'shell]) | |
(def dir (second *command-line-args*)) | |
(defn as-seq [string] (seq (.split string "\n"))) | |
(defn find-by-name [d n] (as-seq (shell/sh "find" "." "-name" n :dir d))) | |
(defn oggs [] (find-by-name dir "*.ogg")) | |
(defn base-name [fname] (.replaceFirst fname "\\..{3}$" "")) |