Skip to content

Instantly share code, notes, and snippets.

View bishboria's full-sized avatar

Stuart Gaλe bishboria

View GitHub Profile
@bishboria
bishboria / springer-free-maths-books.md
Last active April 25, 2024 06:27
Springer made a bunch of books available for free, these were the direct links
package ca.jbrains.pos.test;
import static org.junit.Assert.*;
import java.util.*;
import org.junit.*;
public class SellOneItemTest {
private Display display;
@bishboria
bishboria / multiplication.agda
Last active October 23, 2016 13:14
Exercise: Encode multiplication as a type in 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
; 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 February 21, 2016 08:45
Find all git stashes
find . -iname .git | xargs -I % sh -c 'cd %/..; pwd; git stash list | sed "s/^/ /"'
@bishboria
bishboria / LittleLang.agda
Last active January 17, 2016 16:15
How do I fix the 'cannot decide' error in the opt function?
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
;; 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
@bishboria
bishboria / 2011-04-26-intial-SchemeOO.scm
Created April 26, 2011 22:37
Original attempt at OO with Scheme
(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!)))))
(define (my-for-each proc list-of-values)
(cond ((null? list-of-values) #t)
(else (proc (car list-of-values))
(my-for-each proc (cdr list-of-values)))))
;; or
(define (my-for-each proc list-of-values)
(if (null? list-of-values)
#t
@bishboria
bishboria / childhood-animated-stuff.md
Last active August 31, 2015 09:43
Animated stuff when growing up

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