Skip Navigation

InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)KN
Posts
5
Comments
862
Joined
4 yr. ago

  • No offense, but did you read the article?

    You should at least read the section "Wouldn’t UTF-32 be easier for everything?" and the following two sections for the context here.

    So, everything you've said is correct, but it's irrelevant for the grapheme count.
    And you should pretty much never need to know the number of codepoints.

  • They believed 65,536 characters would be enough for all human languages.

    Gotta love these kind of misjudgements. Obviously, they were pushing against pretty hard size restrictions back then, but at the same time, they did have the explicit goal of fitting in all languages and if you just look at the Asian languages, it should be pretty clear that it's not a lot at all...

  • Yeah, and as much as I understand the article saying there should be an easily accessible method for grapheme count, it's also kind of mad to put something like this into a stdlib.

    Its behaviour will break with each new Unicode standard. And you'd have to upgrade the whole stdlib to keep up-to-date with the newest Unicode standards.

  • Eh, they certainly tried to teach it, but teachers were scared to give assignments that required information they didn't provide ahead of time.
    So, there was never a need to actually apply it, to realize that, hey, if I don't know something, I should absolutely crack open the internet and read up on whatever I can find.

  • Welp, imma try myself at an explanation. Mostly cause I haven't written Haskell in a while either.

    So, that first line:

     haskell
        
    hanoi :: Integer -> a -> a -> a -> [(a, a)]
    
    
      

    ...actually only declares the function's type.

    In this case, it's a function that takes an Integer and three values of a generic type a and then returns a list of tuples of those same as.
    So, those as are just any types representing the towers. Could be strings, integers, custom data types, whatever. The returned tuples represent movements between towers.

    Following that are actually two definitions of the function.

    The first definition:

     haskell
        
    hanoi 0 _ _ _ = []
    
    
      

    ...is the recursion base case. Function definitions are applied, whenever they match, being evaluated top-to-bottom.

    This line specifies that it only matches, if that first Integer is 0. It does not care what the remaining parameters are, so matches them with a wildcard _.
    Well, and to the right side of the equals sign, you've got the return value for the base case, an empty list.

    Then comes the more interesting line, the recursion step:

     haskell
        
    hanoi n a b c = hanoi (n-1) a c b ++ [(a, b)] ++ hanoi (n-1) c b a
    
      

    This line matches for any remaining case. Those small letter names are again wildcards, but the matched value is placed into a variable with the provided name.

    And then, well, it recursively calls itself, and those ++ are list concations. This line's only real complexity is the usual Tower Of Hanoi algorithm.

  • I mean, I do get paid for overtime (flexible work hours) and do like to complete tasks before I go into the weekend, but sometimes all your team mates decide to call it a day, and then yeah, I don't care that hard either...

  • Yeah, I've developed a habit of writing TODO-comments wherever there's still something unfinished. And well, I usually leave in a compile error to force me to continue exactly there.

  • Completely spitballing here based on your anecdotal observation, but I know that with lactose-intolerance, you're lacking lactase for processing the lactose, so the lactose makes it unprocessed into the gut, where the gut microbiota then process the lactose and cause the usual symptomes.

    Well, and those gut microbiota can signal to your brain that they want more of a given food (source).
    So, maybe those bacteria in your gut fucking love lactose, because it is basically sugar, and so they instruct you to self-destruct.