Skip to content

Instantly share code, notes, and snippets.

View kmicinski's full-sized avatar

Kristopher Micinski kmicinski

View GitHub Profile
#lang racket
;; CIS352 'S26 Lecture Notes -- Introduction to the Untyped λ-Calculus
;; ☐ The Untyped λ-Calculus
;; ☐ β-reduction
;; ☐ λ-calculus Semantics and Normal Forms
;; Today we will learn about one of the most central aspects of the
;; course: Alonzo Church's untyped λ-calculus. The λ-calculus is not
#lang racket
;; CIS352 -- Feb 24, 2026
;; □ -- Sets in Racket
;; QuickAnswer
(set) ;; empty set
(set 1 2 3) ;; {1, 2, 3} = {3, 2, 1} = {3, 3, 2, 2, 1, 1, 1}
#lang racket
;; CIS352 -- Feb 18, 2026
;; Consider watching this lecture video on foldr:
;; https://www.youtube.com/watch?v=WUAI_v110NQ&list=PLXaqTeMx01E_eK1ZEpKvKL5KwSaj7cJW9&index=15
(define (count-evens? l)
(foldr (lambda (next-elt acc) (if (even? next-elt) (+ 1 acc) acc))
0
@kmicinski
kmicinski / match.rkt
Created February 17, 2026 21:13
CIS352 'S26
#lang racket
;; CIS352 -- Practice on Pattern Matching
;;
;; If you want more practice, I have a video here: https://www.youtube.com/watch?v=RJFkmh9Wo8o
(define (filter f l)
(if (empty? l)
'()
(cons (f (first l)) (filter f (rest l)))))
@kmicinski
kmicinski / evaluation.rkt
Created February 7, 2026 00:19
CIS352 S'26 Notes: Evaluation Order
#lang racket
;; CIS352 -- Spring 2026
;; Today's agenda...
;; □ -- Evaluation Order
;; □ -- Printf-style debugging and reachability hypotheses
;; □ -- Evaluation of function call
;; □ -- The Stack
;; □ -- Tail Position and Tail Calls
#lang racket
;; CIS352 -- The Algebra of Programming
;; Spring 2026 -- Kristopher Micinski
;; Introduction:
;;
;; Students often ask (in CIS352): "why learn Racket, a language with
;; an arcane syntax that I might not use outside of this class?" It is
;; a very reasonable question, and today we will answer it directly:
@kmicinski
kmicinski / patterns.rkt
Created February 2, 2026 07:49
Pattern matching
#lang racket
;; CIS352 -- Feb 3, 2026
;; Pattern matching:
;; □ -- Trees, manually
;; □ -- Recursion over trees
;; □ -- Introducing pattern matching
;; □ -- Matching list patterns ("quasipatterns")
;; □ -- Matching predicate patterns
;; □ -- Trees, and algebraic data types generally
#lang racket
;; CIS 352 -- Spring 2026
;; 1/27/26 (I believe)
;; quickanswer.harp-lab.com
;; the define form lets us define funcitons
;; (define (f x y z) e-body)
(define (both-even? n0 n1)
#lang racket
;; Notes, 1/22
;; f is a function from α → bool (i.e., a predicate)
;; l is list of αs
;; we return the number of elements in l such that
;; they satisfy the predicate f
;; (count even? '(0 1 2 3 4)) ;; => 3
#;(define (count f l)
@kmicinski
kmicinski / 01-29-notes.rkt
Created January 29, 2026 20:20
Notes: end of class, 1/29
#lang racket
;; CIS352 'S26 -- 1/29 through 2/3
;; □ -- More practice with lambdas
;; □ -- Mapping
;; □ -- Explaining recursion and why it matters
;; □ -- Our first non-list recursive type: trees
;; □ -- Pattern matching