Skip to content

Instantly share code, notes, and snippets.

View acj's full-sized avatar

Adam Jensen acj

View GitHub Profile
@acj
acj / gist:3843841
Created October 6, 2012 04:25
Drawing a circumscribed triangle inside a known circle
// This implementation assumes that the origin is at the upper-left corner of the
// drawing surface.
//
// Sample usage:
//
// Paint paint = new Paint();
// paint.setStyle(Paint.Style.STROKE);
// float centerX = 200;
// float centerY = 200;
// float radius = 100;
@acj
acj / mergesort.clj
Created October 3, 2011 16:43
Merge sort in Clojure
; Example usage: (mergesort [5 1 8 16 25 11 4])
(ns mergesort
(:use clojure.contrib.math))
(defn merge-two
"Merge two (already sorted) vectors"
[vec1 vec2]
(let [v1f (first vec1) v2f (first vec2)]
(cond
(empty? vec1) vec2