[ prog / sol / mona ]

prog


Marvin Minsky - The Beauty of the Lisp Language

126 2020-10-10 20:53

With Lisp eval you have to be aware of the null lexical environment.

Only one of these fails. Guess which one.

clisp:

(defun openFuture (state)
  (eval '(print state)))

(openFuture 't)

python:

def openFuture(state):
    eval('print(state)')

openFuture(True)

node:

function openFuture(state) {
    eval('console.log(state)')
}

openFuture(true)

tcl:

proc openFuture {state} {
   eval "puts $state"
}

openFuture yes

bash:

set -eu

function openFuture () {
    local state=$1
    eval 'echo $state'
}

openFuture true
301


VIP:

do not edit these