Skip to content
This repository has been archived by the owner on May 27, 2022. It is now read-only.

Using + - * / as first-class functions #5

Open
nicolas-p opened this issue Mar 12, 2015 · 2 comments
Open

Using + - * / as first-class functions #5

nicolas-p opened this issue Mar 12, 2015 · 2 comments

Comments

@nicolas-p
Copy link

The following instruction works in the Hy REPL :

(reduce + [1 2 3])

But in the Notebook I get the following error :

  File "<ipython-input-81-3b279c95df1d>", line 1
    from hy.core.shadow import +
                               ^
SyntaxError: invalid syntax

As this happens only in the Notebook, I guess the issue is in the Hy kernel but I'm not sure.

Configuration:
IPython 3.0.0
Python 3.4.2
Hy 0.10.1

@bollwyvl
Copy link
Owner

bollwyvl commented Mar 12, 2015 via email

@bollwyvl
Copy link
Owner

bollwyvl commented Jun 7, 2015

Just had a look into this: sorry for the huge delay.

I don't think the approach that is currently in hy_kernel will be able to support this particular ast hack: I don't see how to generate a string of valid python that uses operators this way. Of course, there is operator.mul, but I imagine this is unsatisfying.

I'll keep this open, but it might have to be somehow changed upstream in hy itself... if code generation isn't a priority, it might not be.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants