> After spending years in functional-land, I find the for loop (and while loop) construct maddening; you have to maintain the state of the entire enclosing scope system in your head.
This is only true if immutability is enforced. In js you see map used to mutate variables outside the scope of the map closure all the time.
const o = {}
const d = [1, 2, 3, 4]
d.map(i => o[i] = i**2)
Which is equivalent to this python.
o = {}
d = [1, 2, 3, 4]
for i in d:
o[i] = i**2
The cognitive load is the same in both. The strength of pure FP languages come from enforced immutability, but that constraint often adds cognitive load in other ways.
> constraint often adds cognitive load in other ways
In my experience (and others) those constraint only reduces cognitive load, it can increase actual performance load, and can make certain algorithms "basically impossible", but you're also never actually writing those algorithms. When was the last time you ACTUALLY used dykstra's A*? Come on, most of us are writing SAASes, APIs/backends and basic frontends here (yes, the rest of you do exist), and even for shitty O(n^2) algos, your n is probably in the 10-20 range. Your bad algorithm will not take down the server.
I think most programmers would disagree with you on this. Perhaps after enough FP experience the cognitive load that comes from the language’s constraints fade away, but I haven’t seen this in practice. FP is less commonly understood and harder for the average dev to work with.
> Come on, most of us are writing SAASes, APIs/backends and basic frontends here (yes, the rest of you do exist), and even for shitty O(n^2) algos, your n is probably in the 10-20 range. Your bad algorithm will not take down the server.
This isn’t related to the earlier point but I’ll bite. This thought process assuming “Your bad algorithm will not take down the server” is a recipe for bad engineering.
For example, we had a bulk action (1-500 records) in our API where the first implementation pulled all the data into memory and processed the data in the request. This ended up being disastrous in prod. It took down our server many times and was tricky to track down because the process would be killed when it maxed out memory.
The solution wasn’t to switch languages or anything. It was just to move the operation to our async worker queue and stream through chunks of data to avoid running out of memory. It cause a lot of headaches for devops that should have never happened.
While you’re right that there are many cases where n is not large, engineers must consider how large n can be or explicitly restrict n before pushing a bad algo to prod.
'FP is less commonly understood and harder for the average dev to work with' citation needed - if anything I'd say the opposite is true, reducing state and mutation etc makes code easier to read and reason about.
Look up any programming language popularity survey. Pure FP languages are substantially less popular, therefore less commonly understood and harder for the average dev to work with.
If FP was the norm, then you could make the same argument for OO.
I started a poll on twitter. Now, obviously there is bias since my twitter audience is mostly FP people, but keep in mind:
- almost all experienced FP people "started in OO", or at least, imperative. So if they are picking map/reduce it is out of experience with the alternative.
- the split between bootcampers/informal and CS/formal is instructive: You can see that "bootcampers", who typically have less need for a low-level mental model of what the metal is doing, find that that for/while loops are harder on the brain than map/reduce:
Pure FP languages may be less popular/common, that doesn't mean FP ideas are harder to understand. In stackoverflow's developer survey https://insights.stackoverflow.com/survey/2021 Clojure was the second most 'popular' language after Rust, and you could argue Rust draws heavily from FP styles too. Languages that are unquestionably OO or procedural, like Java and C, scored lower.
> I've tried Python, hated the inconsistency of it
Can you elaborate on this? I’ve written in both Python and Ruby, but I’m not sure what you mean by this critique of python. I wouldn’t characterize either language as “inconsistent.”
In Python some standard operations are global functions and some are methods. Which are which isn't exactly clear. It's also kind of irrational and random but I hate seeing __init__ everywhere.
For example, to find the length of an array in Python you use the function len(). In Ruby you call the method .length. As the article is about, loops in Python are for blah in blah. In Ruby they're blah.each and for loops are just sugar (not sure why they're there but you can avoid them). In Ruby pretty much everything is an object and you just call methods. Very few keywords, global functions, etc...
Also, as the other poster said, if you call a[0] on an empty array, in Ruby you get nil, in Python it throws an error. Not sure which is better or considered more 'proper', but Ruby's behaviour is what I'd personally expect in a dynamic language.
> In Python some standard operations are global functions and some are methods.
Typically, all of the former are also the latter because the global function just calls the corresponding method. E.g., len(x) works by calling x.__len__().
> As the article is about, loops in Python are for blah in blah. In Ruby they're
...for blah in blah, if you choose to use them at all, which has the same semantics as the python.
It relies on method calls to #each under the hood, and usually in Ruby you won't bother with for/in, but it is there still...
Zuckerberg is 37 years old, so he’d probably be lumped into “the old folks” category. Why would he get it and not us?
I’m, a decade younger than Mark, so idk if I’m young enough by your standards to get it, but my sister and her friends are in college and think this is all a joke. None of them are interested in putting on VR goggles, let alone joining the “metaverse.” None of them had heard of it until Facebook’s name change.
The Metaverse is a top-down Wall Street sponsored hype cycle. It’s not a matter of “old folks” not getting it. It’s Zuckerberg’s attempt to distract Wall Street investors and consumers from Facebook’s growing problems.
> It’s Zuckerberg’s attempt to distract Wall Street investors and consumers from Facebook’s growing problems.
Those problems, at their recent peak, are that – recent.
Yet I know, for a fact, they have been working on the new concept for very long now. I spoke to a FB insider about a year ago already and he, in very diluted way, described what we know as metaverse now.
If you’re looking at the consumer gaming and social media space, then you’d get it.
People underestimate Zuckerberg’s ability to see socio-technical far in the future at their peril. He was ridiculed for making a MySpace competitor, for getting rid of Facebook Apps, for the look & feel changes, the ridiculous prices paid for Instagram and WhatsApp… and he was right each time (for growing his business and his customer base).
Where he has been wrong is in putting Facebook at the centre of his empire, when it’s increasingly a legacy platform for family members, old people and maladjusted conservatives. Metaverse corrects this by making Facebook just one of several properties.
It recommends products that were most frequently included in the same order. So it’s not recommending similar or related products, but products frequently purchased with the product in question, so the wine use-case wouldn’t recommend wine, but it would recommend cheese, bottle openers, chocolate, etc.
This makes sense in the context of the example the author copied from [0], where the dataset is sports equipment. Often purchased in bundles of related products for a specific sport.
Sounds like an inexperienced data engineer. One of the first things you learn is to read tabular data into a DataFrame, like pd.read_csv. So, there’s a natural progression to pd.read_sql [0], which default behavior loads SELECT * FROM t without any filters into a DataFrame. But, it also accepts a raw sql query or SQLAlchemy selectable, which should be used to join/filter data before loading into python.
What kind of consistency models [0] do Offline-first databases like RxDB and PouchDB have?
I was thinking read uncommitted, but they might allow dirty writes. Maybe there’s some CRDTs under the hood… I can’t find any documentation on consistency though, anyone here know?
> Whenever this topic comes up the conversation always centers around money or housing or other brute physical facts
That’s not what the article is about. It’s about bad governing and policing as the primary cause of SF’s homelessness problem.
> He[Michael Shellenberger] blames San Francisco’s woes on a culture of permissive lawlessness and a mistaken view of what constitutes moral policymaking. For example, many on the left believe the lax prosecution of laws is compassionate.
The article also mentioned that this is a problem that’s specific to SF and homelessness in the rest of the country is not as bad.
While I’m as much of a fan of philosophical rants about the decline of human civilization as the next guy, that’s not what the article is about. Also, some comments are unrealistically pessimistic
> The family is the center of a human’s life, and we’ve destroyed it… We look away from our families and attach ourselves to a reactionary “culture” that’s completely…
I see where you’re coming from, but many people’s lives are not like this. The world might be heading this way with all the challenges we’ve faced transitioning society online, but the internet is still very young. We can learn from our mistakes and build healthier social systems.
> I'm (perhaps naively) shocked at how opposed to this people are on Reddit, but especially on HN
> I've worked with and mentored a lot of minority candidates (who often have trouble with the cultural test that is getting and passing interviews)
Maybe have an open, empathetic mind for those people that are so upset? Or ask a minority friend of yours what they think?
From my personal XP: Many black and brown friends of mine think that entrepreneurship is a rich kid’s game because the common first step of raising a “friends and family round” is an absurd notion to them. Most of their friends and family barely have enough money to pay the bills, so the idea of raising $100k+ from them is silly. When I read the angry responses in this thread (and see a price tag like $10k) I think about those friends. I’m sure they’d laugh at the idea of asking friends/colleagues to help them raise $10k to “skip the interview” for similar reasons.
Empathy is hard, especially over the internet and across socioeconomic bubbles, but it’s essential when seeing outrage that you don’t understand.
Damn. I know you don't know me, but this is unnecessarily condescending and off the mark. I'm very well aware of everything you mentioned. Maybe I was unclear. My confusion is about the extent of misunderstanding and willful misrepresentation of the idea, not about the resulting outrage.
Your explanation is a great example -- if you want to look at the idea exclusively in those terms, that sure sounds problematic. But do you really think that's the only way it could have played out? Keep in mind, we are living in a system that causes massive aggregate harm to underrepresented people on a daily basis. And I'm just referring to the tech industry and particularly its hiring practices, let alone society as a whole.
Killing a new idea just because you can conceive of scenarios where it might be harmful (though I would argue not even that much more harmful than the status quo in this case) is probably unwise in general, but is almost certainly so in a space where the status quo is already so fraught. I work in this space, we need more/better ideas (among many other things), and I think this idea actually had a plausible chance of putting a dent in some of the problems at the core of these systemic issues. Sure, it's a small chance, but to just throw it away? That bums me out.
Edit just to be clear: I have no idea who the people behind this site are and had never heard of it before day. I just work on some of the same problems and would love to see the system improve more quickly.
No worries. You caught me at the end of a long day where I was drained from supporting people I care about through some tough situations, so the questioning of my empathy hit a little harder than you could have possibly anticipated. I appreciate the apology and understand where you were coming from, and I wish you well.
This is only true if immutability is enforced. In js you see map used to mutate variables outside the scope of the map closure all the time.
Which is equivalent to this python. The cognitive load is the same in both. The strength of pure FP languages come from enforced immutability, but that constraint often adds cognitive load in other ways.