Skip to content

Instantly share code, notes, and snippets.

@tantaman
tantaman / Cakefile
Created January 22, 2012 14:48 — forked from mattmccray/Cakefile
Cakefile for compiling Coffee and LESS files, optionally compressing them with YUIC
###
Web Toolkit v0.4 (by M@ McCray)
http://gist.github.com/515035
NOTE: This is meant to be used as a Cakefile (Coffee's RAKE equivalent).
###
puts = require("util").puts
@tantaman
tantaman / gist:1285639
Created October 13, 2011 21:49
exercies: binary search - clojure
(defn bsrch [needle haystack]
(loop [low (int 0) high (count haystack) mid (quot (count haystack) 2)]
(if (= (haystack mid) needle)
mid
(if (= high low)
-1
(if (> needle (haystack mid))
(recur (int (inc mid)) high (quot (+ mid high) 2))
(recur low (int (dec mid)) (quot (+ low mid) 2))
)))