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

get rid of zipwith in favor of map #927

Closed
gilch opened this issue Sep 3, 2015 · 4 comments
Closed

get rid of zipwith in favor of map #927

gilch opened this issue Sep 3, 2015 · 4 comments

Comments

@gilch
Copy link
Member

gilch commented Sep 3, 2015

Ref. #240

What is zipwith doing that map doesn't already do? I tried zipwith's unit tests using map instead. Works perfectly:

=> (import operator)
=> (list (map operator.add [1 2 3] [3 2 1]))
[4, 4, 4]
=> (list (map operator.sub [3 7 9] [1 2 4]))
[2, 5, 5]

If zipwith has some other feature I'm not seeing, it should be unit tested. Otherwise, can we get rid of it please?

@zackmdavis zackmdavis added this to the Grand Language Cleanup milestone Sep 3, 2015
@zackmdavis
Copy link
Contributor

I'm in favor of removing zipwith; the duplication with map has been noted previously. 8e4b211 actually removes the original implementation and replaces it with (setv zipwith map), but somehow we seem to have ended up with both versions on master? (One wonders when and how that happened.)

@algernon
Copy link
Member

algernon commented Sep 3, 2015

👍

Anyone want to fire up a PR to drop zipwith?

@refi64
Copy link
Contributor

refi64 commented Sep 3, 2015

Yeah, this was entirely my fault. Up till then, I had used C++ and Haskell more than Python (even though that's changed), so I never realized that map already took multiple iterables. (And I'm guessing the people that liked the zipwith PR didn't realize it either...)

@gilch gilch mentioned this issue Sep 3, 2015
@gilch
Copy link
Member Author

gilch commented Sep 3, 2015

#929 will also remove zipwith.

I never realized that map already took multiple iterables.

I imagine that most Hy users not familiar with Python would miss that. Maybe even some Python users haven't noticed. I'm not sure what to do about that. It's still redundant and should be removed. Perhaps we could point it out in the tutorial or something. Perhaps we should re-document all Python builtins, or at least feature link to that page in the Python docs prominently.

Haskell's prelude and Clojure's core have a lot of useful functions for FP. I wonder if we should port more of them to Hy core. I also wonder how much of that Python already supports somehow.

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