noli

joined 1 year ago
[–] noli@programming.dev 10 points 7 months ago (2 children)

Depends on how deep down the rabbit hole you want to go :p

  • creating a new variable that contains the updated value
  • recursion (e.g. it's not possible to make a loop that increments i by 1, but it is possible to turn that loop into a function which calls itself with i+1 as argument)
  • avoiding typical types of operations that would update variable values. For example instead of a for loop that updates every element of a list, a functional programmer will use the map function, which takes a list and a function to apply to each element of that list to create an updated list. There's several more of these very typical functions that are very powerful once you get used to using them.
  • monads (I'm not even gonna try to explain them as I hardly grasp them myself)
[–] noli@programming.dev 1 points 7 months ago

I want a roof python now

[–] noli@programming.dev 2 points 7 months ago

Good luck reaching an unwilling horse's eye balls

[–] noli@programming.dev 1 points 7 months ago

I also vaguely remember such a story but there the aliens got fukd up because when all hope was lost humans just started kamikaze-ing their ships. Spite is our superpower.

[–] noli@programming.dev 3 points 7 months ago (3 children)

If you get prep time you could set up some traps.

Assuming both sides see it as a fight to the death, the horse will also engage so you could just run away into a bunch of traps. All you need is for the horse to injure a leg in one trap and it's done for. I think even just some holes with a couple spikes would be enough to injure and maybe even sprain an ankle.

Without prep time you're pretty doomed, I think your best bet is either climbing up a tree to buy you some prep time to make a spear out of the branches or worst case diving in, aiming to do damage to its legs (unlikely) and hope you are able to get out without being trampled (unlikely)

[–] noli@programming.dev 45 points 7 months ago (2 children)

Dogmatic statements like this lead to bad, messy code. I'm a firm believer that you should use whatever style fits the problem most.

Although I agree most code would be better if people followed this dogma, sometimes mutability is just more clean/idiomatic/efficient/...

[–] noli@programming.dev 31 points 7 months ago (6 children)

In functional programming, everything is seen as a mathematical function, which means for a given input there is a given output and there can be no side effects. Changing a variable's value is considered a side effect and is thus not possible in pure functional programming. To work around this, you typically see a lot of recursive and higher order functions.

Declaring all values as const values is something you would do if you're a diehard functional programmer, as you won't mutate any values anyway.

[–] noli@programming.dev 9 points 8 months ago (2 children)

Paywalled article

[–] noli@programming.dev 10 points 8 months ago (1 children)

It's all learned behaviour. If you grew up with F that makes total sense and C sounds ridiculous. If you grew up with C that's totally intuitive for anyone, just as much as F, so using a scale that has no point outside of the weather sounds dumb. Neither system is more intuitive by any means. Both systems ave benefits and downsides.

Whenever I talk to americans and they use F I need to convert it because I grew up with C and that just makes more sense to me, even if I know the "0-100 F is according to human experience" thing. Like sure, 80F is hot, but how hot is it? Oh 27C that's hot but not extreme.

Arguing one or the other is superior is not only pointless but also just silly

[–] noli@programming.dev 26 points 8 months ago* (last edited 8 months ago)

Tar Xtract Ze Vucking File

Edit: apparently someone else already mentioned this, oops

[–] noli@programming.dev 1 points 8 months ago* (last edited 8 months ago) (1 children)

Yuki had been on kmag's arse for 10+ laps without passing. Daniel just closed a 9 second gap to the two. Yuki was never passing. Daniel might've.

It's easy to say after the fact "bUt hE DidN'T PaSS hiM DiD hE?", but u gotta look from the perspective from the race engineers. Who is most likely to get a pass: the guy who's been trying and failing for 10 laps or the other guy who just closed a 9 second gap and is on a different strategy? Yuki just let his ego cloud his judgement, which is understandable in the heat of the moment but not in a dangerous "revenge" action 15 minutes later. IMO he should get at least a fine for that move after the checkered flag if not a time penalty. What he did was stupid and dangerous

view more: ‹ prev next ›