Skip to content

Instantly share code, notes, and snippets.

View sliminality's full-sized avatar

Slim sliminality

View GitHub Profile
@sliminality
sliminality / about.md
Last active April 10, 2019 07:19
Example of structural inheritance in Racket

Structural inheritance

If you have a bunch of structs with common properties or functions (in the English sense, not the CS sense), it makes sense to define a parent type (or base type) encoding those common properties and functions, and have other types inherit those properties and functions from the parent.

If type A inherits from type B, then A is a subtype (or child type) of B. A subtype is a "more specific" version of its parent type.

Defining a subtype

Here is the syntax for declaring a subtype:

@sliminality
sliminality / Hidden Markov Models.carbide.md
Last active November 12, 2016 23:32
Hidden Markov Models

Hidden Markov Models

EM Examples

@sliminality
sliminality / Expectation Maximization.carbide.md
Last active September 17, 2017 19:37
Expectation Maximization

Expectation Maximization

@sliminality
sliminality / begin.rkt
Created November 7, 2016 15:42
Recitation 6: Imperative Programming
; (begin
; <FunctionCall#1>
; <FunctionCall#2>
; ...
; <ReturnFunctionCall>)
; ; executes a sequence of function calls, one at a time
; ; returns the value of the last one
; vend/outside-stock : number -> string or number
@sliminality
sliminality / how-cons-works.rkt
Last active October 31, 2016 01:33
recursion recitation notes
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; NOTE: This particular week's examples are much easier to read in DrRacket,
; since they make heavy use of the comment box. Would recommend downloading
; the .rkt files off the website and viewing them on your own computer.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;
; how cons works
;;;;;;;;;;;;;;;;;;;;;;;;;;
@sliminality
sliminality / conditionals.rkt
Created October 24, 2016 02:27
111FA16 Quiz 1 Review Session
; Conditionals
; (if <this> ; boolean
; <then-this>
; <else-this>)
; (if (and (> x a)
; (< x b))
; "x in range"
@sliminality
sliminality / map-filter-examples.rkt
Created October 17, 2016 04:34
map and filter examples from EECS 111 recitation
(define-struct person (name age))
(define CONTACTS (list (make-person "Sarah" 20)
(make-person "Ian" 99)
(make-person "Bob" 14)
(make-person "Joe" 15)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; map example
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;