Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Sure, that's an option. It's also an option to only write for loops.

I gave you a solution that solves readability and costs you nothing in performance, and you reject it without saying why. *shrug*

> Reduce is a superset of map/filter

Edit: you're saying that reduce can be abused into a map and a filter. Yes, okay I take your point.

[deleted]

> I meant the actual map, filter, and reduce functions that are part of python

I think you meant "not part of python", I guess I'd agree on that, but then again it's irrelevant. I don't care what mechanism you use to iterate over a list and apply a function to every item, whether it be a comprehension or a map function. The end result is the same, and I'd argue that comprehensions are, or can be, a little cleaner syntactically.




Comprehensions are part of python, the language. Map/filter/reduce as you've indicated, isn't, it's clearly a library.

In addition you previously complain that python doesn't have what you want "I get access to reduce... [in Ruby]" then prove that it does have it, so I don't see what you're saying.

> Clojure is all of the built in functional bits.

Are you saying map, filter, reduce are implemented in the core language and not an add-on library?


> Comprehensions are part of python, the language. Map/filter/reduce as you've indicated, isn't, it's clearly a library.

I guess, it's true that reduce is part of an included library. But map and filter are "built-in functions". I guess you could make a distinction between those and the language proper, but that's splitting some pretty fine hairs.

> In addition you previously complain that python doesn't have what you want "I get access to reduce... [in Ruby]" then prove that it does have it, so I don't see what you're saying.

Here's what I said:

"Yes, I know that python has map, filter, and reduce. But they're all gimped by the way python implements lambdas."

> Are you saying map, filter, reduce are implemented in the core language and not an add-on library?

If you look at the clojure cheetsheet[1], you can see all of the built-ins (most are functions, some are macros) that Clojure supports (as well as some included libraries).

map, filter, and reduce are all built ins. I strongly doubt that they're supported at the syntax level, but that's kind of lisp's shtick - even stuff like "+" is a built in function, and not "part of the language".

---

1. https://clojure.org/api/cheatsheet


I think you're being slightly harder on python than is entirely necessary but you've made your point well.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: