3 ms·
Solving Riddles with Prolog and ES6 Generators (2014)
- Waterluvian 7y agoPartly related but generators clicked for me when I heard them described as, "instead of pushing data into a function, you're pulling results out of a function." I've been doing a lot of asyncio lately and just having a mental model of my pipelines working by pulling results through them has been invaluable.
- pault 7y agoBut you're also pushing data back in. Generators are coroutines that can be suspended and resumed, and the yield keyword is a mechanism for two way communication between the routine and coroutine.
- Waterluvian 7y agoTrue. The idea doesn't hold as well now that data can be passed into a generator in Python. Ie. Now that there's coroutines.
- slig 7y agoShameless plug: I run a website with dozens of such puzzles that can be solved online. If you're interested, google "zebra puzzles", should be the first link.