Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: variable of whole array in mapping functions #223

Open
kckennylau opened this issue May 4, 2017 · 6 comments
Open

Feature request: variable of whole array in mapping functions #223

kckennylau opened this issue May 4, 2017 · 6 comments

Comments

@kckennylau
Copy link
Contributor

e.g. in the lambda of m, what if we used b to refer to the whole array and d to each item?

The same goes with f, and o.

@isaacg1
Copy link
Owner

isaacg1 commented May 4, 2017

That's a neat idea. Might be rather tricky to implement, however. Also, I'd like to do it without using up more variables, if possible. The last time this came up, we did it with ;. Can you think of any other characters that are invalid inside a lambda? Also, can you give some sample code using this feature?

@kckennylau
Copy link
Contributor Author

fq2/bT[1 1 2 2 3) should give [1,1,2,2].

@jakobkogler
Copy link
Contributor

How about a 2-char variable. (@isaacg1 Is this possible?)

Alternatively ( is available.

@kckennylau
Copy link
Contributor Author

Why is ( available?

@jakobkogler
Copy link
Contributor

( was (or is) the tuple constructor. And tuples don't have any purpose in Pyth any more, Pyth only uses lists.
When Pyth was created, some methods worked differently, when applied to a tuple instead of a list. But at some point isaacg1 changed it, so that there is no difference between both types any more. Also he change all methods, such that they will return lists instead of tuples. For instance appending a number to a tuple will return a list. The only thing he didn't removed was (. And now this token has been useless for quite some time.

@Jim-Bar
Copy link

Jim-Bar commented Jul 6, 2017

I agree with this feature request. Moreover that could be implemented for .e as well.

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

No branches or pull requests

4 participants