• 3 Posts
  • 51 Comments
Joined 1 year ago
cake
Cake day: June 19th, 2023

help-circle





  • Honestly, it is much more code to use loop with non-local control like break, continue etc. (variable initialization, append, variable mutation in loops…) than just calling a collect function (which I assume just means to_list). In the above example, in most programming language I know, you don’t even need to collect the result into a list.

    Not to mention, large loops with non-local control is a breeding ground for spegatti code. Because you no longer have a consistent exit point to the loop, thus making the semantics hard o reason about.

    In many languages, there are type class / trait / interfaces (whatever you want to call them) that allows lazy structures to share the same API as strict ones.













  • There are several competing protocol: zigbee, zwave, and the newest is matter. They just require a hub to be controlled.

    I use all zigbee smart switches, and a conbee II usb stick. I have a old laptop running homeassistant os, and it has a one click addon for conbee II. I think amazon echo also have builtin zigbee controller.

    If the power goes out, all the switch automatically connects back to the hub when the power is back. Obviously, this setup is not affected by google, amazon, even the entire internet goes down. As long as my router is functional, I can control everything using my phone, when I am at home.