[ prog / sol / mona ]

prog


Marvin Minsky - The Beauty of the Lisp Language

155 2020-10-11 19:51

Racket:

#lang racket

(define (openFuture state)
  (define ns (make-base-namespace))
  (namespace-set-variable-value! 'state state #f ns)
  (eval '(print state) ns))

(openFuture '?)

What's that #f doing you ask? Well, here is the beautiful explanation from the docs:

If map? is supplied as true, then the namespace’s identifier mapping is also adjusted (see Namespaces) in the phase level corresponding to the base phase, so that sym maps to the variable.

Behold the freedom and beauty of phase levels!

And don't forget "#lang racket" because racket needs to know that you're using racket.

301


VIP:

do not edit these