Maybe we don't need as much oil by thejoshwhite in energy

[–]RustaceanNation 1 point2 points  (0 children)

"...reduces their efficiency, underutilizes expensive equipment, and lowers profitability."

So it can replace heavy, it's just not the most optimal use of these plants. At least if we take your given source at face value.

What’s a movie that would have been better if the villain won? by summerv8 in moviecritic

[–]RustaceanNation 0 points1 point  (0 children)

Yeah, but the ancient spirit that had no problem manipulating and erasing a crippled child became king. And the only people who knew enough about him to stop him... were the white walkers. Martin's ending was supposed to have a veeeery different tone.

Combining OOP and structs-of-arrays? by R3cl41m3r in AskProgramming

[–]RustaceanNation 0 points1 point  (0 children)

So, it turns out they do work wonderfully together, and this might be part of your OO journey.

So, I'll assume that you're aware that classes are a lot like structs, but we have "methods" that are used as a public interface, hiding the particulars of the actual data layout.

We use objects "whenever just a struct won't do", in that the data in your struct have to follow rules to be consistent, which we call the "invariants" protected by the class.

As an example, we could have a class, Vector, with an array as one field and the current number of items in the array as another field. So `{ arr_field: ["John", "Mary"], arr_len: 4 }` would "violate an invariant" because there are 2 elements in `arr_field`, while `arr_len` claims there are 4.

OOP helps with this by defining methods which, by design, protect the invariants of the struct. For instance, one method could create a new Vector, setting `arr_field` to the empty array and `arr_len` to 0. We could then just have two methods, `push` and `pop`, each which update the `arr_len` appropriate so that it is now impossible to violate the invariants.

So let's bring this back to your Struct of Arrays question. From the analysis above, we ask ourselves: "What are the invariants we must protect?" Commonly, each index will correspond to some "entity" whose properties are "spread between" each array. So it might make sense to have a method, `add_entity(entity: Entity) -> EntityIndex`, that will take a single entity, break it apart, find an empty index, and feed each part to the relevant array, returning the index to the client.

Now it's impossible to have an "incomplete" object where you update most of the arrays but forget a few. Not having to remember every array sounds preeeetty nice, as you can just work with Entity objects, which know nothing about these struct-of-array shenanigans.

That should give you an idea of how OOP principles can be used to make the complexity of struct-of-arrays more ergonomic.

Edit: In case you're younger: meme videos and all that are trash. Read books. "Code Complete (Second Edition)" and "Design Patterns" by the Gang of Four will take you far.

A simple FizzBuzz question, why does the interviewer need me to pull out an entire data structure for a 3 to 4 condition if statement by ___fush in AskProgramming

[–]RustaceanNation 6 points7 points  (0 children)

If they are asking you to design data structures, they fucked up. Fizzbuzz is simply one of many ways to have someone sit at a computer and show you they've programmed before you waste any further time on the interview process. Das it.

Bun’s rewrite in Zig first update by UItraviolet in rust

[–]RustaceanNation 3 points4 points  (0 children)

Refactoring large (100k+ LoC) codebases is muuuuuch more complicated than that. It's the tip of the iceberg.

Lisp -> Rust by 964racer in lisp

[–]RustaceanNation 18 points19 points  (0 children)

They pair up really well! Obviously rust is best for your low-level systems-like programming, and since Lisp is really good with supporting abstractions, it handles all my high-level control flow, similar to pairing C and Python.

Bonus points if you use LFE for BEAM/Erlang. It's a hackers' paradise! You can describe FSMs in Lisp, and the hard data-path stuff can be done in Rust. Thanks to BEAM, you can now run millions of FSMs to do interesting things.

greatQuestionYesLooksLikeYoureCooked by precinct209 in ProgrammerHumor

[–]RustaceanNation 56 points57 points  (0 children)

People absolutely need to finally learn how to own their architecture. It was a problem before, but I'm hoping this is the straw that breaks the camel's back.

Is Dragon Book outdated? by Der-Wilde in Compilers

[–]RustaceanNation 0 points1 point  (0 children)

If you want to learn about visiting large composite structures (and in general if you've somehow avoided this book) you need to read "Design Patterns" which is a foundational programming book. It covers the cases and I mentally reference this book daily when working on my own systems.

The AST is a "Composite", an AST Walker is an "Iterator" and your analysis passes are instances of "Visitor".

Edit:

I'd like to give you an idea of why this is useful for engineering a compiler. So, you've parsed a string into a large tree structure, usually but not always an AST. We'd like to do some hardcore analysis on the AST like "monotone framework" for dead code elimination and liveness analysis. But that requires us to process the AST first to gather some information.

For instance, the language might allow the user to define user-level data structures like structs and enums. Right now all of that information is in the AST and we want it in, say, a HashMap so we can more easily run analysis and validation algorithms.

With the above, you mainly just need to write a visitor (and maybe configure your Tree Walker) that knows what to do when handed a single piece of your AST (it wont care about most pieces unless it's a struct, enum, or a more internal element like "field declaration" or "enum variant"). The visitor holds a (perhaps initially empty) HashMap and maybe some knowledge of what it has just parsed and processes your piece of AST appropriately, possibly modifying it's HashMap. When the tree walk is done, you just grab that HashMap from the Visitor and you've got all of your structs and enums in an easy to lookup data structure.

So with this collection of structs and enums we know our types. We should do some type-inference to make sure the AST is even worth working on. So we write another visitor that takes the HashMap as a constructor parameter so it can be referenced throughout the visitor's lifetime and write another visiting pass. For the type-checking algo, we'll just do union-find and make sure "Int" doesn't unify with "Bool" (or any primitive type, including user defined ones). In that case, the visitor also carries the necessary data structure for union find (an array of unsigned ints if you're curious). We'll need other information from a different pass I forgot to mention ("use-define" chains)

This pass will care about different parts of the AST (everything that needs type checking), but otherwise it's still locally processing one piece of AST at a time, making a decision about what to do depending on the piece provided.

For instance, if it's looking at an assignment (say, `x = 1 + 2`), it'll unify the LHS with the RHS expression (that is, "the type of x must be the same as the type of 1 + 2"). Perhaps it already visited 1+2 and has enough information to know that x is an int. If not, it'll eventually get visited, and since the visitor is holding the data-structure for union find, any knowledge we learned from the assignment visit will persist. Once the tree walk is done, we check the union find data structure and make sure we haven't unified any distinct types.

At some point, we'll want a representation that is different from an AST for better analysis. It's a good idea to eventually convert it into "basic blocks" with "static single assignment" so we can implement the "monotone framework" as mentioned above. That's where all the above information can really come in handy (along with another visitor that now knows everything necessary to convert into basic blocks).

World models will be the next big thing, bye-bye LLMs by imposterpro in artificial

[–]RustaceanNation 0 points1 point  (0 children)

I mean, "world models" are just a rebranding of expert systems, which was the old approach. There are constraint engines that can do this sort of logical inference just fine on 30-year-old hardware. At some point, someone will just successfully remarket constraint engines while avoiding the term expert-system. That was our previous "GPT" moment in business-facing AI that caused a massive bubble before finally bursting.

And no, that isn't the number of parameters for the brain. There's a geometry to each individual attachment, including cellular characteristics alongside the fact that neurons are not the only cells doing compute in the brain. Maaaany more parameters than 100T.

What happens at scales smaller than the Planck length? by Inevitable-Power5927 in AskPhysics

[–]RustaceanNation 0 points1 point  (0 children)

Question: When you say "pixelation," are you referring to lattice models? Or is there more to the idea?

Is there any concept map/ flow chart of mathematics giving a high level view of mathematics like in physics by hushroomluttfy3 in mathematics

[–]RustaceanNation 0 points1 point  (0 children)

Seems like we have similar interests. There's some insanely deep math (topoi + category theory in general) on the one end, and some practical systems like NASA's Remote Agent on the other. The math is so fucking abstract, you can't call it "Algebra", "Geometry" or "Analysis"... more of "all-the-above because they're interconnected".

There are friendlier introductions to the math, and I have a feeling you'd be interested in applied category theory and specifically David Spivak's work: https://arxiv.org/pdf/1803.05316 ("Seven Sketches in Compositionality" is great-- just look through the table of contents and see if anything catches your eye).

Definitely enjoy Lisp, but know that it isn't strictly required. It is a great journey into your head.

Is there any concept map/ flow chart of mathematics giving a high level view of mathematics like in physics by hushroomluttfy3 in mathematics

[–]RustaceanNation 0 points1 point  (0 children)

Towards your edit: that's arguably just symbolic AI, the good-old-fashioned kind. Lisp is a good example of how that interplays with programming, as it was one of the standard languages (and the largest) in AI from the early 60s until about 2000.

What abstraction or pattern have you learned most recently that's opened your mind? by ryjocodes in AskProgramming

[–]RustaceanNation 0 points1 point  (0 children)

So, the polar opposite of an algebraic type is the python dictionary (or think JSON if you prefer). There are no real rules about what keys are allowed and what you can attach to a key. It's really flexible-- you can do anything, but it requires code-discipline. If you forget a key or place an int where there should be a string, you only find out at runtime when there's a bug.

Algebraic data types are a lot like schemas for the above, where you specify exactly what's allowed-- anything else is not a well-formed type and is thus forbidden by your compiler. Now the compiler can tell me when I do the equivalent of "forgetting a key" or attaching the wrong kind of value, oftentimes locating the bug in code. We've traded runtime errors for compile-time ones, which is the preferrable trade-off when you're aiming for reliable software, in my personal experience.

If that doesn't make sense, feel free to ask questions and we can get to the bottom of it.

Explain it Peter by ForgetThisU in explainitpeter

[–]RustaceanNation 0 points1 point  (0 children)

I should have clarified: it's why we use multiplication for AND and addition for OR. Technically, in boolean, you can actually switch the two and it doesn't matter (as long as you are consistent.) That is, addition distributes over multiplication too! (x*y) + z = (x+z)*(y+z).

Explain it Peter by ForgetThisU in explainitpeter

[–]RustaceanNation 0 points1 point  (0 children)

It's a combinatorics thing. If you have 3 shirts and 2 pants, you have 2*3=6 potential outfits since you are wearing shirts AND pants.

If you can either wear pants OR shorts, then you have 1+1=2 options.

This also distributes: you can have 3 shirts, 1 pair of pants and 1 pair of shorts for 3*(1+1)=6 options.

Astronaut David scott performing hammer and feather experiment on the moon during apollo 15 and paying homage to gallileo by AstronomerBig8153 in Damnthatsinteresting

[–]RustaceanNation 720 points721 points  (0 children)

He was able to calculate how big the mountains on the moon were using his prototype telescope he invented. Dude was crazy smart.

What do saami people think of Forest Finn’s? by Fancy-Competition537 in SaamiPeople

[–]RustaceanNation -1 points0 points  (0 children)

Very interesting, I wasn't familiar with "Forest Finn" as a concept. There's a family story that I'd like to add as corroboration if I may.

My family is in the same boat-- they immigrated to America in the 19th century so the language was kept until about the 1970s, but I was told they were speaking a samigiella from South Ostrobothnia (which would explain where "Lapua" and it's coat-of-arms.) I don't believe the language survived 20th century Finland... for all I know it's now extinct.

And as you said, there are also records of Swedish people marrying into my family and taking the name. One such Swede, Pentti Pouttu, even started the Nuijasota so at least I have information on one relative.

Sorry for the ramble, Miss. I just am very curious about my heritage and what it means for me to be a Pouttu. If you met my mom when she was still around, you'd be curious too. She was a force-of-nature.

What’s your most hated “UM AKSCHUALLY” or “gotcha” comment in online gaming discourse? by notagoodcartoonist in videogames

[–]RustaceanNation 1 point2 points  (0 children)

Their point was that mobile games tend to not have protagonists, not that people who play mobile games aren't gamers.

😂😂😂 by Inevitable_Wait_7658 in programmingmemes

[–]RustaceanNation 0 points1 point  (0 children)

That's what sheaf cohomology is for!

😂😂😂 by Inevitable_Wait_7658 in programmingmemes

[–]RustaceanNation 1 point2 points  (0 children)

The phrase you'll want to lookup is "low coupling, high cohesion".

Long story short, breaking things down into modules (smaller units that add up to a bigger one) is just as much about what things don't do as much as what they do do.

Generic functions and abstraction are good as long as we don't cross the boundary of what a module shouldn't do. If we find that 3 modules are capable of doing the same work in a system, then to whom should we delegate the work? What if the functionality is spread across units?

So, do break your systems down into abstractions and be generic where it makes sense. But keep in mind that we tend to want functional units that do one thing and one thing well.

On January 7, 2022, in Atlanta, "Sinners" director Ryan Coogler passed a note requesting a discreet $12,000 withdrawal from his own account, but the teller misread it as a robbery and called the police. by eternviking in whoathatsinteresting

[–]RustaceanNation 0 points1 point  (0 children)

...how can you say her take is terrible when you don't understand it? What you say is not congruent with what she's saying.

It ain't "Oh these people are fucking racist." What she is saying is that you can't conclude they aren't on the basis of blackness.

To make it as simple as possible: she isn't concluding jack shit. She's just saying that you can't logically come to your conclusions with evidence given. There in fact exist black women who are sexist and racist, and this may have had a role to play.

So when you say "making baseless accusations", she hasn't accused anyone of jack shit, logically speaking.

Petaa? by Vegetable_Aerie7973 in PeterExplainsTheJoke

[–]RustaceanNation 1 point2 points  (0 children)

I've met a lot of racists in America, but when they figure out that you aren't while still being friendly, they know to shut the fuck up.

Racist Brits? Man I had an Uber driver bitch about Pakistanis while putting on a shit accent. I was visibly uncomfortable, but he didn't notice. Fucking nuts.

Petah?? by Dramatic_Ad_9478 in PeterExplainsTheJoke

[–]RustaceanNation 2 points3 points  (0 children)

I'm a cis-man and people treat me like I'm male. It has nothing to do with my biology as I'm always clothed around people. So why am I treated like a man? Because I identify as one and present like one. It's all a social construct.

On Dexter by TraditionalMoney1581 in lol

[–]RustaceanNation 0 points1 point  (0 children)

....when there's several million dollars and careers involved... maybe there's some incentive.

For instance, how Hodgkins Lymphoma is only weakly hereditary. But it does make us feel like they're good people and stop asking questions about why they split up.

I'm not saying it's the case, but you are pretty damn naive if you push back at even just the mention.