📝Racket: Parameters

Racket parameters are basically dynamically-scoped variables.

#lang racket
(define name (make-parameter "world"))

(define (hello)
  (printf "Hello, ~a!\n" (name)))

(parameterize ([name "blah"])
  (hello))

(hello)
Hello, blah!
Hello, world!

Backlinks

Want to receive my 🖋 posts as I publish them?