Hy fork
2ad2d5a418
As reported in issue #748, there was a bug in which passing a lambda as the value of a :keyword argument would fail— $ hy --spy hy 0.10.1 using CPython(default) 3.4.0 on Linux => (sorted (range 10) :key (fn [x] (- x))) from hy.core.language import range sorted(range(10), key=_hy_anon_fn_1) Traceback (most recent call last): File "<input>", line 1, in <module> NameError: name '_hy_anon_fn_1' is not defined The function call would appear in the generated AST without being preceded by the appropriate function definition corresponding to the anonymous function argument value in the Hy source, causing either a NameError (as in the example above), or erroneous reuse of whatever function was already pointed to by the `_hy_anon_fn_` name referenced in the list of keywords passed to `ast.Call`. This commit aims to fix the problem by handling it in same way that the expression/statement gap is bridged many other places in the compiler, by adding the compiled value of the keyword argument to the Result object being built during `_compile_collect`, with the understanding that any Python statements implied by the argument value will be appropriately preserved therein. |
||
---|---|---|
bin | ||
docs | ||
eg | ||
hy | ||
scripts | ||
tests | ||
.coveragerc | ||
.dockerignore | ||
.gitignore | ||
.mailmap | ||
.travis.yml | ||
AUTHORS | ||
CONTRIBUTING.rst | ||
Dockerfile | ||
LICENSE | ||
make.bat | ||
Makefile | ||
NEWS | ||
README.md | ||
requirements-dev.txt | ||
requirements-travis.txt | ||
setup.cfg | ||
setup.py | ||
tox.ini |
Hy
Lisp and Python should love each other. Let's make it happen. Try it.
Hylarious Hacks
OK, so, why?
Well. Python is awesome. So awesome, that we have so many tools to alter the language in a core way, but we never use them.
Why?
Well, I wrote Hy to help people realize one thing about Python:
It's really awesome.
Oh, and lisps are neat.
(fan art from the one and only doctormo)
Project
- Code: https://github.com/hylang/hy
- Docs: http://hylang.org/
- Quickstart: http://hylang.org/en/latest/quickstart.html
- Bug reports: We have no bugs! Your bugs are your own! (https://github.com/hylang/hy/issues)
- License: MIT (Expat)