Skip to content

Instantly share code, notes, and snippets.

Avatar

Stuart Gaλe bishboria

View GitHub Profile
View minimal-oo.scm
; Minimal "object oriented" scaffolding
(define (object methods)
(lambda (label method-parameters)
((cdr (assoc label methods)) method-parameters)))
; declaration: easily do funkier state stuff here
(define (person name dob)
(object `( (name . ,(lambda () name))
(age . ,(lambda (today) (- today dob)))))) ; absolute nonsense, but an example of param passing
@bishboria
bishboria / git-stashes.sh
Created Feb 21, 2016
Find all git stashes
View git-stashes.sh
find . -iname .git | xargs -I % sh -c 'cd %/..; pwd; git stash list | sed "s/^/ /"'
@bishboria
bishboria / springer-free-maths-books.md
Last active Aug 27, 2021
Springer made a bunch of books available for free, these were the direct links
@bishboria
bishboria / childhood-animated-stuff.md
Last active Aug 31, 2015
Animated stuff when growing up
View childhood-animated-stuff.md

I want to have a list of the cartoons/films that I watched as a child. I have flashbacks of themetunes and images, but can't always work out what they are.

Updates will add more shows, and screenshots/youtube links if possible

  • Trapdoor
  • Transformers
  • Starcom
  • Centurions
  • Mask
  • Adventures of Teddy Ruxpin
View keybase.md

Keybase proof

I hereby claim:

  • I am bishboria on github.
  • I am bishboria (https://keybase.io/bishboria) on keybase.
  • I have a public key whose fingerprint is 4243 FB55 3364 0BE8 D08E 876F 078A 4BBA 842F C1A0

To claim this, I am signing this object:

@bishboria
bishboria / LittleLang.agda
Last active Jan 17, 2016
How do I fix the 'cannot decide' error in the opt function?
View LittleLang.agda
module LittleLang where
open import Data.Bool
open import Data.Nat
data type : Set where
tNat tBool : type
data exp : type Set where
nat : exp tNat
View SingleCaseInduction.agda
module SingleCaseInduction where
-- Usual definition of ℕ
data N : Set where
z : N
s : N N
-- Single case definition of ℕ
data _+_ (A : Set) (B : Set) : Set where
@bishboria
bishboria / multiplication.agda
Last active Oct 23, 2016
Exercise: Encode multiplication as a type in Agda
View multiplication.agda
-- This was an exercise: to encode _×_≡_ using _+_≡_
module Multiplication where
open import Data.Nat using (ℕ; suc; zero)
-- Addition encoded as a type
data _+_≡_ : Set where
zp : {n} zero + n ≡ n
sp : {m n k} m + n ≡ k suc m + n ≡ suc k
@bishboria
bishboria / 2011-04-26-intial-SchemeOO.scm
Created Apr 26, 2011
Original attempt at OO with Scheme
View 2011-04-26-intial-SchemeOO.scm
(define (person person-name person-age)
(define (name)
person-name)
(define (age)
person-age)
(lambda (selector)
(cond ((equal? selector 'name) (name))
((equal? selector 'age) (age))
(#t '(I cant do that Dave!)))))
View 2011-04-26-SchemeOO.scm
;; All the OO stuff
(define (object selector-names . all-selectors)
(define (apply-it selector selector-names selectors parameters)
(cond ((null? selectors) '(I cant do that Dave!))
((equal? selector (car selector-names)) (apply (car selectors) parameters))
(#t (apply-it selector (cdr selector-names) (cdr selectors) parameters))))
(lambda (selector . parameters)
(apply-it selector selector-names all-selectors parameters)))
;; Defining a new object type