Skip to content

Instantly share code, notes, and snippets.

View whoisjake's full-sized avatar

Jake Good whoisjake

View GitHub Profile
@whoisjake
whoisjake / lithp.rb
Created October 21, 2013 15:51 — forked from fogus/lithp.rb
class Lisp
def initialize
@env = {
:label => lambda { |(name,val), _| @env[name] = val },
:quote => lambda { |sexpr, _| sexpr[0] },
:car => lambda { |(list), _| list[0] },
:cdr => lambda { |(list), _| list.drop 1 },
:cons => lambda { |(e,cell), _| [e] + cell },
:eq => lambda { |(l,r), _| l == r },
:if => lambda { |(cond, thn, els), ctx| eval(cond, ctx) ? eval(thn, ctx) : eval(els, ctx) },
@whoisjake
whoisjake / mindstorm.rb
Created July 4, 2011 21:42 — forked from michaelbernstein/mindstorm.rb
Lego Mindstorm Installer Gist
#!/usr/local/bin/ruby
require 'find'
p "This script will copy the contents of your LEGO MINDSTORMS NXT disc to your desktop, make necessary adjustments to the installer for Mac OS X 10.6 and later, and then initiate the MINDSTORMS installer. Please insert the MINDSTORMS NXT disc before you continue. Would you like to continue? (Y/N)"
$name = gets.chomp
if $name[0,1].casecmp("Y") == 0
$NXT_CD_Mounted = false
Dir.entries("/Volumes").each do |path|
(ns life (:use clojure.test clojure.set))
(def under-populated 1)
(def over-populated 4)
(def fertile 3)
(defn north [[x y]] [x (inc y)])
(defn south [[x y]] [x (dec y)])
(defn east [[x y]] [(inc x) y])
(defn west [[x y]] [(dec x) y])