• 0 Posts
  • 24 Comments
Joined 1 year ago
cake
Cake day: July 3rd, 2023

help-circle






  • 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)


  • 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.devtoScience Memes@mander.xyztemperature
    link
    fedilink
    English
    arrow-up
    11
    arrow-down
    1
    ·
    7 months ago

    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.devtoLinux@lemmy.mlArch or NixOS?
    link
    fedilink
    arrow-up
    1
    ·
    10 months ago

    Did you truly read what I said? The only logical way I can frame your comment is that you glanced at what I wrote down and started writing a reply.

    To a regular average windows user, ubuntu is incredibly complicated. When you learm how it works and how you’re supposed to use it, it becomes incredibly easy. The “hard” part of ubuntu is the paradigm shift from windows to the linux ecosystem.

    Similarly, to an average linux user nixos is “hard” because it does things completely differently from other linux distros. But once you’re used to it, it just makes sense and is easy.

    So the comparison is average windows user -> ubuntu vs average linux user -> nixos. Not average user -> ubuntu vs average user -> nixos.

    Finally: Nixos documentation is IMO 100x better than ubuntu documentation. Whenever I experience any issue with ubuntu it’s easier to just load up the arch wiki and hope it’s similar than it is to try and find anything specific for ubuntu that isn’t either 10 years out of date, a massive gaping security risk or just plain dumb. The nixos wiki may not be perfect but it has always been sufficient for my needs, and I have to run a decent amount of very niche pieces of software.


  • noli@programming.devtoLinux@lemmy.mlArch or NixOS?
    link
    fedilink
    arrow-up
    1
    ·
    10 months ago

    It’s incredibly complicated in the same way that ubuntu is incredibly complicated to a lifelong windows user.

    It just requires a bit of a paradigm shift which includes a learning curve but IMO once you’re past that point it’s intuitive and even easier than other distros.