Hacker News new | past | comments | ask | show | jobs | submit login
Solving Riddles with Prolog and ES6 Generators (2014) (curiosity-driven.org)
38 points by zephyrfalcon on April 27, 2019 | hide | past | favorite | 6 comments



Partly 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.


But 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.


True. The idea doesn't hold as well now that data can be passed into a generator in Python. Ie. Now that there's coroutines.


Shameless 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.


I want to check it out but all of the Google results are for Einstein's Riddle. What's the link?


It’s the same thing.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: