Skip to content

Instantly share code, notes, and snippets.

View filter-installers.rkt
#lang racket
;; filter the lines in "installer-data" as indicated in the release
;; checklist.
;; filter out lines that match a predicate, report on the remaining set
(define (filter-out description pred l)
(define new-l (filter (compose not pred) l))
(printf "discarding these ~v:\n" description)
View 2020-05-18-pm-sps.rkt
#lang racket
(define last-str #f)
(struct node (l r))
(require rackunit)
(define (b-after-a? tree)
(match tree
View 2020-05-18-sps-am.rkt
#lang racket
(define last-str #f)
(define (b-after-a? tree)
(match tree
[(? string? s)
(cond [(and (equal? s "b")
(equal? last-str "a"))
View 2020-05-18-am.rkt
#lang racket
(module sim-AQSE3.5 racket
(provide
(rename-out [lambda lam])
#%module-begin
#%app
#%datum
+ - * / >= <= > <
View recursion using y-comb
#lang racket
#;((define loop-maker
(λ (loop-maker)
(λ (n)
(if (< n 17)
((loop-maker loop-maker) (+ n 1))
n))))
View 2020-05-04-am.rkt
#lang racket
;; this module defines the sim-AQSE3 language, which
;; simulates AQSE3, by providing
;; only a few key forms from Racket. Specifically: lambda,
;; function calls, if, constants, and a few arithmetic
;; operators.
(module sim-AQSE3 racket
(provide
(rename-out [lambda lam]
View friday PM example
#lang typed/racket
(require typed/rackunit)
;; an S-expression is one of:
;; a number
;; a string
;; a boolean
;; a symbol, or
;; (list S-expression ...)
View end of friday class...
#lang typed/racket
(require typed/rackunit)
;; an S-expression is one of:
;; a number
;; a string
;; a boolean
;; a symbol, or
;; (list S-expression ...)
View Friday AM example
#lang typed/racket
(require typed/rackunit)
;; an S-expression is one of:
;; a number
;; a string
;; a boolean
;; a symbol, or
;; (list S-expression ...)
View make-add-stars-work.rkt
#lang typed/racket
(require typed/rackunit)
;; an S-expression is one of:
;; a number
;; a string
;; a boolean
;; a symbol, or
;; (list S-expression ...)