• 0 Posts
  • 28 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.dev
    cake
    toMemes@lemmy.mlA glowing review
    link
    fedilink
    arrow-up
    3
    arrow-down
    1
    ·
    5 months ago

    Context: I’m european. I know for sure the people at my local coffee shops are being paid a living wage, cause there’s laws for that.

    Paying your employees a living wage is included in what I see as “a sustainable business model”.

    I know the owner of my local coffee shop personally and while they charge €4 or more depending on the coffee you’re getting AND they roast their own coffee, so they cut down on the bean costs significantly while generating some extra profits as well by selling the beans, they still aren’t “just raking it in” as you make it seem.


  • noli@programming.dev
    cake
    toMemes@lemmy.mlA glowing review
    link
    fedilink
    arrow-up
    13
    arrow-down
    1
    ·
    5 months ago

    A coffee from a coffee shop definitely should be $4 if you want them to ethically source good coffee and have a sustainable business model.

    There’s still cheap, shitty coffee that’s built on modern slavery there’s always like mcdo. SB is the same quality ingredients but with knowing how to steam milk + syrups


    1. several languages that are still in use have eager evaluation.

    2. I’m a dumb programmer. The more I need to keep implicit behaviour in mind, the higher the probability I’m writing bugs. Short circuit evaluation is an optimization technique IMO and shouldn’t be relied upon for control flow.

    3. The aggressive tone you’re using is completely unnecessary and immature, so I’ll refrain from responding any further. Have a nice day.