Skip to content

Instantly share code, notes, and snippets.

def fib(n, i=1, a=0, b=1):
if i == n: return b
return fib(n, i + 1, b, a + b)
(* Iterative approach; O(1) memory *)
fun factorial n =
let
val tally = ref 1
val i = ref 1
in
while !i < n do
tally := !tally * i
i := !i + 1;
end;
X:1
T:The Edinburgh Fire Brigade
C:David M. Gardner
M:C|
L:1/8
K:Dmix =c
A2 AB ABdf | edef edBd | A2 AB ABdf | edef a2 a2 |
A2 AB ABdf | edef edBd | AFDF AFDF | GECE D2 D2 :|
|: DEFG ABAF | GECE GECE | DEFG ABAF | GECE G2 G2 |
DEFG ABAF | GECE GECE | AFDF AFDF | GECE D2 D2 :|
@tsmacdonald
tsmacdonald / gist:7328178
Last active December 27, 2015 12:48
Wizard-Professor Setup
  • git clone https://github.com/tsmacdonald/wizard-professor.git or copy it from the turnin directory
  • Create ~/.sbclrc and paste in the following:
(let ((quicklisp-init "/homes/tim.macdonald/quicklisp/setup.lisp"))
	(when (probe-file quicklisp-init)
	(load quicklisp-init)))
  • Create .config/common-lisp/source-registry.conf.d/projects.conf and paste in the following, changing the path as necessary:
$ rvm info
jruby-1.6.7@iopro:
system:
uname: "Linux phantasmagoria 2.6.32-5-amd64 #1 SMP Sun May 6 04:00:17 UTC 2012 x86_64 GNU/Linux"
bash: "/bin/bash => GNU bash, version 4.1.5(1)-release (x86_64-pc-linux-gnu)"
zsh: "/usr/bin/zsh => zsh 4.3.10 (x86_64-unknown-linux-gnu)"
rvm:
datatype MetasyntacticVariable = foo | bar | baz | quux;
interface MetasyntacticVariable {}
interface foo implements MetasyntacticVariable {}
interface bar ...