Skip to content

Instantly share code, notes, and snippets.

View racket-raccoon's full-sized avatar
🦝
I told you something didn't feel right!

Levon racket-raccoon

🦝
I told you something didn't feel right!
View GitHub Profile
@racket-raccoon
racket-raccoon / wumpus.rkt
Created October 29, 2026 12:35
REPL playable "Grand Theft Wumpus" game from "Land of Lisp" book written in Racket
#lang racket
(require 2htdp/image)
(define congestion-city-nodes #f)
(define congestion-city-edges #f)
(define visited-nodes #f)
(define player-pos #f)
(define node-num 30)
@racket-raccoon
racket-raccoon / Dockerfile
Created April 23, 2026 17:44
Dockerfile for a reproducible WebRacket dev environment (Racket 9, Node exnref, wasm-tools, and preinstalled compiler deps) that can compile .rkt to WebAssembly/JS and serve browser examples.
# syntax=docker/dockerfile:1.7
FROM node:24-bookworm-slim
ARG DEBIAN_FRONTEND=noninteractive
ARG RACKET_VERSION=9.0
ARG WASM_TOOLS_VERSION=1.247.0
ARG WEBRACKET_REPO=https://github.com/soegaard/webracket.git
ARG WEBRACKET_REF=main
@racket-raccoon
racket-raccoon / unit-circle-trig-visualizer.rkt
Created February 8, 2026 16:39
Racket script that renders a frame-by-frame animation linking a unit circle to synchronized sine and cosine plots, with radian ticks and moving projection markers
#lang racket
(require plot/no-gui racket/draw racket/file)
(define PANEL-WIDTH 500)
(define WIDTH (* 2 PANEL-WIDTH))
(define HEIGHT 500)
(define FRAME-COUNT 120)
(define FRAME-ID-WIDTH
(max 2 (string-length (number->string (sub1 FRAME-COUNT)))))
@racket-raccoon
racket-raccoon / coin-change.rkt
Last active October 27, 2024 20:33
Coin Change Problem: Dynamic programming vs Recursive
#lang racket
(define (cc-recursive amount coins)
(define (denom kinds-of-coins)
(vector-ref coins (sub1 kinds-of-coins)))
(define (cc amount kinds-of-coins)
(cond
[(= amount 0) 1]
[(or (negative? amount) (zero? kinds-of-coins)) 0]
@racket-raccoon
racket-raccoon / cheatsheet.rkt
Last active November 28, 2021 19:59
RACKET 101
; named let tail recursion pattern
(define (square n)
(let loop ([n n])
(if (= n 1) 1 (* 2 (loop (- n 1))))))
; clojure trick: return iterator-like lambda, local variables are captured and the state persists between calls
(define (helper)
(let ([result 0])
(λ () (if (= result 0)
(set! result 1)