lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I just ran the following through Guile (the Gnu version of
Scheme) and got "baz".

  (let ((foo 'bar))
    (define func (lambda ()
                    foo))
    (set! foo 'baz) ;; Alters the foo within func.
    (func))

The Lua equivalent (which also gives "baz") is

  local foo = "bar"

  function func()
    return foo
  end -- func

  foo = "baz" -- Alters the foo within func.

  print(func())

Guile is the only lexically scoped Lisp I have access to
from my current location, but my understanding is that any
modern lexically scoped Lisp would work the same way.

-- 
Aaron