Comment on Dropbox is hiring a Web EngineerparentComments−petdog16yIt's not broken at all, and not in any way peculiar to javascript. >>> map(apply, [lambda:i for i in range(5)]) [4, 4, 4, 4, 4] * (mapcar 'funcall (loop for i from 0 to 5 collect (lambda () i))) (6 6 6 6 6 6) It's just that the looping constructs don't introduce a new binding, but modify the existing one. >>> map(apply, [lambda j=i:j for i in range(5)]) [0, 1, 2, 3, 4] * (mapcar 'funcall (loop for i from 0 to 5 collect (let ((j i)) (lambda () j)))) (0 1 2 3 4 5)
Comments
It's not broken at all, and not in any way peculiar to javascript.
It's just that the looping constructs don't introduce a new binding, but modify the existing one.