Skip to content

Instantly share code, notes, and snippets.

@danmidwood
danmidwood / sicpratio.clj
Created March 18, 2013 01:36
Translation of SICP make-rat, denom and numer operations to Clojure with the addition of Typed Clojure to define a "SicpRatio" type as an alias to a vector of size 2
(ns complex-clojure.core
(:require [clojure.core.typed :as t])
(:use [clojure.core.typed :only [AnyInteger]]))
(t/def-alias SicpRatio (Vector* AnyInteger AnyInteger))
(t/ann make-rat [AnyInteger AnyInteger -> SicpRatio])
(defn make-rat [numer denom] [numer denom])
(t/ann denom [SicpRatio -> AnyInteger])
@danmidwood
danmidwood / ClojureIntro.md
Last active December 14, 2015 03:09
Evangelising Clojure at the Mind Candy Tech Forum

"Clojure Logo"

Let's REPL

In a terminal type: lein repl

; semi-colon marks the rest of the line as a comment
@danmidwood
danmidwood / gist:4220425
Created December 5, 2012 23:20
A bunch of notes and numbers from Tech Mesh day #2

In Day#1 Meta-Ex used Quil (built on processing) for the visuals https://github.com/quil/quil#readme

Keynote: Erlang. 183 Years of Programming

  • Mike Williams
  • Joe Armstrong
  • Robert Virding

183 is miscalculation. 122.

@danmidwood
danmidwood / gist:4208356
Created December 4, 2012 20:30
A bunch of notes and numbers from Tech Mesh day #1

Keynote

Wadler: talking about currying. fn of arity one, return fn until there is no more arity left, and then the evaluation.

Haskell: Deep, simple principles. Purity, DSL, Types. SPJ:"laboratory for exploring crazy type systems"

Wadler: [On Type Classes in Haskell] Ad-hoc polymorphism: Type Classes allow you implement this on your own types (e.g + < > ...) -- "Binary method problem" -- assuming both parameters to a method have the same dictionary. Haskell requires this passed in.

@danmidwood
danmidwood / git_commit_dump
Last active October 3, 2015 14:47
Check out commits in order, dumping commit messages in between.
#!/bin/bash
if [ -n "${1}" ]
then
startref=${1}..
fi
# Record the starting location, branch or hash
branch_name="$(git symbolic-ref HEAD 2>/dev/null)" || branch_name="$(cat .git/HEAD)"
branch_name=${branch_name##refs/heads/}