defn nested in defn seems totally wrong from a LISP (or Clojure) viewpoint. Isn't there a let or letfn? (Please note that I have no idea of Python)
Frankly, I'd prefer if it were idiomatic to locally defn inside Clojure defns, letfn is not hardly so elegant or clear. One of a number of areas where I find Clojure needlessly less tasteful and elegant than Scheme, but all are at least tolerable.
foo = lambda x: x*2
If only that lambda statements are limited (by design?) to only a single return expression.As far as Hy goes, lambdas won't have this limitation.
>>> mycode = "a = int(raw_input()); print a * 2; return a"
>>> myfunc = FunctionType(compile(mycode, "<string>", "exec"), globals())
>>> myfunc()
4
8
4 >>> from types import *
>>> mycode = "a = int(raw_input()); print a * 2; return a"
>>> myfunc = FunctionType(compile(mycode,"<string>","exec"), globals())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 1
SyntaxError: 'return' outside function
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 1
SyntaxError: 'return' outside function