• 0 Posts
  • 47 Comments
Joined 2 years ago
cake
Cake day: August 14th, 2023

help-circle



  • Kache@lemm.eetoProgrammer Humor@programming.devstop
    link
    fedilink
    arrow-up
    4
    ·
    edit-2
    2 months ago

    It’s a container with certain behaviors and guarantees making them easy and reliable to manipulate and compose. A practical example is a generic List, that behaves like:

    • List[1, 2, 3], i.e. (“new”, “unit”, “wrap”) to create, containing obj(s)
    • map(func) to transform objs inside, List[A] -> List[B]
    • first(), i.e. (“unwrap”, “value”) to get back the obj
    • flat_map(func), i.e. (“bind”) to un-nest one level when func(a) itself produces another List, e.g. [3, 4].flat_map(get_divisors) == flatten_once([[1, 3], [1, 2, 4]]) == [1, 3, 1, 2, 4]

    Consider the code to do these things using for loops – the “business logic” func() would be embedded and interlaced with flow control.

    The same is true of Maybe, a monad to represent something or nothing, i.e. a “list” of at most one, i.e. a way to avoid “null”.

    Consider how quickly things get messy when there are multiple functions and multiple edge cases like empty lists or "null"s to deal with. In those cases, monads like List and Maybe really help clean things up.

    IMO the composability really can’t be understated. “Composing” ten for loops via interlacing and if checks and nesting sounds like a nightmare, whereas a few LazyList and Maybe monads will be much cleaner.

    Also, the distinction monads make with what’s “inside” and what’s “outside” make it useful to represent and compartmentalize scope and lifetimes, which makes it useful for monads like IO and Async.




  • If you want to entertain having kids, you need to be ready for a radical shift in your life priorities. Your kids will take priority over just about everything – often even yourself. They’ll take priority over your parents entirely, let alone your personal relationship with them.

    First, are the practical and logistical aspects of your life at all dependent on your parents? I.e. are you fully independent? You will need to be and then some, you’re going to entertain having kids.

    Once you’re fully independent and additionally have resources to spare (time, effort, money, space, etc, usually b/c you’re with a partner you can trust and rely on), then choosing to have kids means starting your own family – not your parents’ family.

    If the grandparents are supportive and helpful, that’s great! They’re extremely welcome to contribute to your kids’ lives (and lighten some of your parenting load!)

    However, if they’re negatively impacting you or esp your kids, then they can lose that privilege. Again, your priority will be your kids. If this is a real concern for you, you’ll need to factor it into your “ready to have a kid” considerations.












  • In recreational climbing, skin calluses and surface abrasion aren’t usually much of a concern compared to tendon health. Skin heals light damage quite easily.

    However, it’s not uncommon for a new (or experienced) climber to develop their muscles beyond what their own tendons can take. Since it takes tendons so long to strengthen, it’s common to need managing the risk of finger pulley tendon injuries in climbing.

    Also, I do not know how these nuances apply in your context of your medical condition.


  • wanted to add something to the end of a for-loop, but had too little indentation

    To address this, I prefer reducing length & depth of nested code, so the for/while is rarely ever not visible along with everything inside it. Others have success with editors that draw indentation lines.

    opening up new/anonymous scopes

    I occasionally use Python nested functions for this purpose


  • I find it’s possible to operate Python as a statically typed language if you wanted, though it takes some setup with external tooling. It wasn’t hard, but had to set up pyright, editor integration, configuration to type check strictly and along with tests, and CI.

    I even find the type system to be far more powerful than how I remembered Java’s to be (though I’m not familiar with the newest Java versions).