Recent comments in /f/killallgames

bunnies wrote

tbh I think it's a bit of sad that these old games are losing their mystique. The idea that there are ancient, forgotten tricks is very appealing, in a romantic way.

On the other hand, I really like the current collaborative optimization efforts, illustrated in their best shape in the recent super mario bros 4-2 progression video https://www.youtube.com/watch?v=i1AHCaokqhg

6

Moonside wrote (edited )

I actually first stumbled into rational number data type when I was 12 or 13 and learning Lisp (but that story didn't end well and which totally gave me a misleading view of how principled programming languages were). I think all the major functional languages have them as it's not hard to implement as an abstract data type. A super basic is just a product type of two integers and call one the numerator and the other denominator and implement the operations accordingly.

Even Coq has them and if Coq has something implemented, it's probably pretty widespread in Haskell, Standard ML, OCaml, Scala and various Lisps and what have you.

If you really want some numeric nonsense:

  1. Bad implementations of complex numbers. The rectangular form a + bi is good for sums and re^(iθ) for multiplications. Ideally there should be one type for complex numbers and two classes like data Complex = Rectangular a b | Polar r θ in Haskell. This works ok if there are sum types, but apparently this is too avant garde for most languages.
  2. The Haskell numeric tower makes zero sense and is implemented with type classes, which isn't first class and is antimodular to the extent I recommend beginners only use library defined ones and not make your own like at all for a while at least. Like the Num class for numbers: you need to implement the operations (+), (*), abs, signum, fromInteger, (-) where abs and signum are total party poopers as basically what Num is is a mathematical ring with an extra operation. But, for example, complex numbers don't have a notion of absolute value defined for them so this turns sour quickly. I don't know what would make the situation better, however. They'll never fix this, probably.

Also if you want to read a rant about Booleans... this is pretty good. Every time I'm writing a function that takes a boolean parameter, I split it in two functions or somehow avoid testing for equality in the function. Thus pattern matching is bae and matching constructors is heaven sent. The author's piece on why dynamic languages aren't a thing at all is good too.

Phew, I'm glad that I got all that out of my system!

3