This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-13
Channels
- # admin-announcements (1)
- # announcements (40)
- # aws (2)
- # babashka (46)
- # babashka-sci-dev (106)
- # beginners (31)
- # cider (5)
- # circleci (2)
- # clj-kondo (48)
- # clojure (118)
- # clojure-belgium (1)
- # clojure-chicago (3)
- # clojure-europe (19)
- # clojure-ireland (3)
- # clojure-losangeles (2)
- # clojure-nl (2)
- # clojure-spec (10)
- # clojure-uk (4)
- # clojurescript (18)
- # community-development (5)
- # core-async (159)
- # cursive (16)
- # datomic (16)
- # etaoin (1)
- # fulcro (21)
- # funcool (14)
- # graalvm (5)
- # gratitude (4)
- # holy-lambda (28)
- # jobs (1)
- # jobs-discuss (1)
- # kaocha (1)
- # lsp (12)
- # malli (21)
- # meander (12)
- # music (1)
- # off-topic (8)
- # portal (5)
- # react (18)
- # reitit (1)
- # releases (4)
- # remote-jobs (1)
- # shadow-cljs (56)
- # timbre (4)
such an interestingly frustrating read, i must share https://americanexpress.io/faccs-are-an-antipattern/
> I still maintain that the practice of naming things matters.
> Let’s say that you had a function that took two numbers, added them together and returned the result. What would you call that function? You might call it add
, or maybe sum
.
const add = (a, b) => {
return a + b;
};
add(2, 2);
Yea. don't do that. dont make that function, it already exists. The author is lamenting that things don't have good names and then he introduces a function with a terrible name. that function he wrote isn't "add" it's "add-only-two-things"
(+ a b) isnt' unnamed, the code is the name, and it's a better name because it's as true to me as it is to the compiler.+ is a name
and its so amazing we reduced it to two lines and one character.
But i take your point, if you had to pass that function in clojre you would write #(+ %1 %2)
but you could just pass (apply + <some collection)
though apprently thats slower then (reduce + <some collection>) in some cases i cant remember.
But yeah, I have to say, I also got frustrated even with that, since 'add' and 'sum' are entirely different mathematical concepts and thus different functions
but the more frustrating part for me was that they identify a problem and then bring a worse solution on it 😄
> + is not the thing here @U0VQ4N5EE what do you mean?
I mean, the author is attempting to make an argument about fitting names and compares add with badger and tapioca and children. It's clearly a bad argument, since children is part of the React API. So I am not trying to defend it. That said, I think because + operator can be imagined as a function (or even have a language where it actually is a function that does exactly what they say the new function would do) doesn't mean that the author is talking about the same function. I can do this little bit of steelmanning their argument so that I can focus on the much bigger inaccuracies in the article.