3 ms·
#1 is definitely not meh, it's actually really practical if you're doing real work in Lisp. It seems meh if you're doing academic "basic CS concepts" exercises
by silentbicycle 16y ago
#1 is definitely not meh, it's actually really practical if you're doing real work in Lisp. It seems meh if you're doing academic "basic CS concepts" exercises in Lisp, though.
> #3 re Python (and intial mention that languages arent written in themselves) just sounds like author is not up to date with modern python.
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> def foo():
x = 0
def bar(y):
x += y
return x
return bar
>>> baz = foo()
>>> baz(3)
Traceback (most recent call last):
File "<pyshell#10>", line 1, in <module>
baz(3)
File "<pyshell#7>", line 4, in bar
x += y
UnboundLocalError: local variable 'x' referenced before assignment
Is 2.7.1 not "modern" enough? I was under the impression that a lot of people are still on 2.7 rather than switching to Python 3. (I switched to Lua for scripting; it has working closures, lambdas, tail recursion, etc.)
- njharman 16y agothe way original was worded it didn't sound like author was describing that particular wart, but, rather believing closures didn't exist. Generators, yield. PyPy