Elektrine lite

← Feed

Rylik

Rylik@mastodon.social

Posts

  • Post #2060888

    My fav chptrs are: Data Norm., Exist. Process. and FSM. I started prefixing my functions based on this table here, which makes it very easy to track bugs(the prefix alone makes me more aware ). There are some funny “philosophical” questions that arrive doing this, and I wonder what @fabs answer would be. Would an init func be a mutating func or a gen func. You could argue that uninited space is muted on initialisation, but that’s usually not thought of as a mutation.

  • Post #2060887

    Been inspired by @lemire and started to practice some more bit ops (python code from phone ). labels = ["{}","Buzz", "Fizz","FizzBuzz"] for i in range(1, 101): dv3 = int(i % 3 == 0) dv5 = int(i % 5 == 0) sel = (dv3 << 1) | dv5 print(labels[sel].format(i)) Reasoning (pretty obv) div 3 T (1<<1)|0 = 2 (idx for Fizz) div5 T (0<<1)|1 = 1 (idx for Buzz) both T (1<...