• 0 Posts
  • 6 Comments
Joined 1 year ago
cake
Cake day: June 11th, 2023

help-circle
  • I know I’m probably not changing your mind on this but interested in how you would want the system to be? Regarding your point about being able to rotate the clock so it matches the local solar cycle, suppose we’re in a place where we have 13, at the top of the clock, because that’s when midnight is where we are.

    And let’s say it’s Wednesday 3rd April today. What happens when the clock reaches 13? After 1 second elapses, does your local clock go from Wednesday 3rd April 12:59:59 to…

    a) Wednesday 3rd April 13:00:00 b) Thursday 4th April 13:00:00

    If a) then you have the problem that the date change is now in the middle of the day, and most of the time you can’t even say “what day is it today”. (If 13:00 is midnight, then 00:00, when the date would roll over, would be just before noon.) You have to say today is "Wednesday/Thursday, or “3rd/4th April” because when you wake up it’s Wednesday, but after lunch it becomes Thursday.

    If b) then you have the problem where it may be Thursday 4th April 13:00:00 where you live, but actually it’s not midnight yet somewhere else and so simultaneously it’s Wednesday 3rd April 13:00:00 there. And in fact every location has their own time at which the date rolls over and it’s not even possible to interpret a timestamp unless you have a table that tells you when midnight is for each location.

    Maybe you feel that one or both of these are not really big enough of a problem, or maybe you can think of some other way of dealing with this that I haven’t thought of. And yeah, both of these issues sort of happen already with timezones – the issue in a) happens if you stay up past midnight, but at least it always happens at midnight at not when most people are awake and doing their business. The issue in b) sort of happens already since it can be Wednesday in one place and Thursday in another, but at least the timestamp would always indicate how many hours past the date rollover it is.


  • t_veor@sopuli.xyzto196@lemmy.blahaj.zonefixed rule
    link
    fedilink
    arrow-up
    11
    ·
    9 months ago

    It’s sometimes called comma-leading style where you move all the special characters to the front of the line and it is exceedingly common in Haskell, possibly due to how Haskell treats significant whitespace. You’ve surely seen list definitions that look like this:

    someList =
      [ 1
      , 2
      , 3
      ] 
    

    or a data definition like this:

    data Color
      = Red
      | Green
      | Blue
      | RGB Int Int Int
      deriving (Show, Eq)
    

    or a list of module exports like this:

    module Foo
      { bar
      , baz
      , quux
      } 
    

    Or in a long function type declaration where the arrows are moved to the start of the line, or a record definition, etc. etc.



  • It’s not that hard to check yourself. Running the following code on my machine, I get that the linear algebra algorithm is already faster than the naive algorithm at around n = 100 or so. I’ve written a more optimised version of the naive algorithm, which is beaten somewhere between n = 200 and n = 500.

    Try running this Python code on your machine and see what you get:

    import timeit
    
    def fib_naive(n):
        a = 0
        b = 1
        while 0 < n:
            b = a + b
            a = b - a
            n = n - 1
        return a
    
    def fib_naive_opt(n):
        a, b = 0, 1
        for _ in range(n):
            a, b = b + a, b
        return a
    
    def matmul(a, b):
        return (
            (a[0][0] * b[0][0] + a[0][1] * b[1][0], a[0][0] * b[0][1] + a[0][1] * b[1][1]),
            (a[1][0] * b[0][0] + a[1][1] * b[1][0], a[1][0] * b[0][1] + a[1][1] * b[1][1]),
        )
    
    def fib_linear_alg(n):
        z = ((1, 1), (1, 0))
        y = ((1, 0), (0, 1))
        while n > 0:
            if n % 2 == 1:
                y = matmul(y, z)
            z = matmul(z, z)
            n //= 2
    
        return y[0][0]
    
    def time(func, n):
        times = timeit.Timer(lambda: func(n)).repeat(repeat=5, number=10000)
        return min(times)
    
    for n in (50, 100, 200, 500, 1000):
        print("========")
        print(f"n = {n}")
        print(f"fib_naive:\t{time(fib_naive, n):.3g}")
        print(f"fib_naive_opt:\t{time(fib_naive_opt, n):.3g}")
        print(f"fib_linear_alg:\t{time(fib_linear_alg, n):.3g}")
    

    Here’s what it prints on my machine:

    ========
    n = 50
    fib_naive:      0.0296
    fib_naive_opt:  0.0145
    fib_linear_alg: 0.0701
    ========
    n = 100
    fib_naive:      0.0652
    fib_naive_opt:  0.0263
    fib_linear_alg: 0.0609
    ========
    n = 200
    fib_naive:      0.135
    fib_naive_opt:  0.0507
    fib_linear_alg: 0.0734
    ========
    n = 500
    fib_naive:      0.384
    fib_naive_opt:  0.156
    fib_linear_alg: 0.112
    ========
    n = 1000
    fib_naive:      0.9
    fib_naive_opt:  0.347
    fib_linear_alg: 0.152
    

  • t_veor@sopuli.xyzto196@lemmy.blahaj.zonerule
    link
    fedilink
    arrow-up
    9
    ·
    edit-2
    1 year ago

    I’ve seen cum used in Indian English pretty often in its Latin meaning, as in “with” and used often to mean something that serves multiple purposes. So this is talking about some kind of tank ammo which penetrates and blasts (presumably armour).

    It was also used in other dialects of English as well, and we still have Latin phrases like “magna cum laude” (meaning “with great honour”), but some other meaning of the word has become more prominent…


  • In Icelandic we have the neopronoun “hán”, which I know some nonbinary folk here use regularly. I’m not a native speaker so I can’t properly evaluate how awkward it is, and I’ve definitely seen grumbling from natives about how it doesn’t feel natural, but to me as a learner it feels completely reasonable and fits into the rather complicated grammar of Icelandic perfectly.

    Just like how English distinguishes between subject/object/possessive for pronouns (I/me/my, he/him/his, she/her/her, they/them/their), Icelandic has 4 cases for nouns and pronouns. Hán behaves exactly like a regular neuter noun when inflected, declining like “hán/hán/háni/háns” for each of Icelandic cases. Compare the regular neuter word borð (table), which declines like “borð/borð/borði/borðs”.

    Adjectives also decline for gender in Icelandic, but as you may have guessed nonbinary folk predominantly use the neuter gender, which agrees with the pronoun hán. There of course already existing a third person neuter pronoun in Icelandic, “það”, but its meaning is more like the English “it” and most people prefer understandably to not to go by it.

    Also interesting but not pronouns is how Icelanders use names. Basically Icelanders don’t have a family name the way most other western countries do (… with exceptions), their last name is instead the name of their father, in possessive, plus -son or -dóttir. So if you are the son of your father, Einar, your last name would be Einarsson, literally “Einar’s son”. If you were the daughter of Einar, your last name would be Einarsdóttir, literally “Einar’s daughter”. This system of surnames is called patronymic surnames, and recently there has been more matronymic surnames as well – for example former football player Heiðar Helguson’s mother would have been called Helga, and his last name means “Helga’s son”.

    This is of course problematic for nonbinary people who do not wish to use either -son or -dóttir, but recently it was allowed to use the neuter ending -bur instead, which repurposes an archaic word meaning “son” but is just used to mean a gender neutral “child” nowadays.