Hy fork
Go to file
Zack M. Davis 2ad2d5a418 fix keyword lambda values by retaining statements in Result
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.
2015-04-26 15:57:08 -07:00
bin Make hy2py public. 2014-04-30 01:51:21 +03:00
docs Added name to AUTHORS and added documentation 2015-03-19 08:43:11 +00:00
eg the mega typo fix commit 2014-05-05 23:47:14 +05:30
hy fix keyword lambda values by retaining statements in Result 2015-04-26 15:57:08 -07:00
scripts Move reformat-changelog into scripts. 2014-11-15 07:52:20 -05:00
tests fix keyword lambda values by retaining statements in Result 2015-04-26 15:57:08 -07:00
.coveragerc Adding support for coverage tests at coveralls 2013-12-03 01:58:35 +05:30
.dockerignore Add initial .dockerignore file 2014-10-06 13:37:51 -06:00
.gitignore Provide bin scripts for both Windows and *nix 2013-07-14 09:06:42 -06:00
.mailmap added new mail 2014-09-08 14:56:04 +02:00
.travis.yml travis: run in container infra & remove pypy hacks 2015-02-26 11:29:11 +05:30
AUTHORS Added name to AUTHORS and added documentation 2015-03-19 08:43:11 +00:00
CONTRIBUTING.rst Various changes to documentation pages 2014-12-05 23:15:48 -08:00
Dockerfile update my email 2014-11-22 10:28:31 -05:00
LICENSE Removing my name from the license. 2013-04-05 20:04:36 -04:00
make.bat Implement yield-from in Python 2.x as a macro 2014-11-20 20:48:15 -06:00
Makefile travis: run in container infra & remove pypy hacks 2015-02-26 11:29:11 +05:30
NEWS Another typo. Don't be a release manager in the morning 2014-10-10 09:53:33 -04:00
README.md Miscellaneous changes to README 2014-12-08 07:38:13 -08:00
requirements-dev.txt Make ci builds faster by splitting requirements 2014-05-13 22:47:19 +05:30
requirements-travis.txt Add a Botsbuildbots function 2014-09-05 12:37:51 +02:00
setup.cfg Add universal Wheel support. 2014-03-18 10:33:10 +02:00
setup.py bump astor dependency to 0.5 to support matrix multiplication operator 2015-04-19 20:24:25 -07:00
tox.ini Implement yield-from in Python 2.x as a macro 2014-11-20 20:48:15 -06:00

Hy

Build Status Downloads Version Coverage Status

XKCD #224

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.

Cuddles the Hacker

(fan art from the one and only doctormo)

Project