lua-users home
lua-l archive

Re: upvalues actually are values?

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


On 23/10/2012 20:19, Johann Hibschman wrote:
I'm curious: what languages would print 1 and 2 below? I can't think of one.
The equivalent Scheme,
 (define (inc i) (lambda (n) (+ n i))
 (define i 1)
 (define inc1 (inc i))
 (inc1 0)
 (set! i 2)
 (inc1 0)
should never ever print anything other than 1 and 1.
You are right, my example is wrong!
Denis

AltStyle によって変換されたページ (->オリジナル) /