I make things: electronics and software and music and stories and all sorts of other things.

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

help-circle












  • This is honestly so frustrating to see bc I’ll still never understand why Python isn’t just statically typed.

    It’s right there in the Zen:

    Explicitness is better than implicitness

    It wouldn’t even have to be less simple as it could still be weakly typed, a la Rust or Haskell, but not as robust.

    You wouldn’t need these extra special tools if the language was just built right!

    Same goes for the try/catch exception system where runtime errors can pop up bc you don’t have to handle exceptions:

    Errors should never pass silently.

    Unless explicitly silenced.

    Python is a good language that could’ve been a great one smh




  • Here’s how I think it works

    In formal language, what it means to accept a verification means does the result fall into the list of acceptable values.

    Consider adding two 2-bit numbers:

    • Alphabet: { 0, 1}
    • Language: x x consists of four binary digits representing two 2-bit binary numbers where the result of adding these two numbers is a valid 2-bit binary number (i.e. falls between 00 and 11)
    • Then you have an automata that will:
      • Start from the rightmost bit
      • Add the corresponding bits (+ carry from any previous iterations)
      • Carry over to the left if needed
      • Repeat for both bits
      • Check for acceptance
    • Machine as a whole simply checks did the inputs produce a valid 2-bit number, so it just accepts or rejects

    The machine itself simply holds this automata and language, so all it does is take input and reject/accept end state. I think you’re just getting caught up in definitions

    A sum of a list of numbers I think would be something like

    • Alphabet: digits 0-9 and ‘,’
    • Language: a single string of digits or a single string of digits followed by a comma and another valid string
    • Automata:
      • Are we a single string of digits? If yes, accept
      • Sum the last number into the first and remove the comma
      • Repeat
    • Machine: Does the some operation result in a valid string?

    Machines accept a valid state or hit an error state (accept/reject). The computation happens between the input and accept/reject.

    But maybe I don’t understand it either. It’s been a while since I poked around at this stuff.