This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ; 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) |