3 ms·
You can do the same in Python, which steals Haskell’s list comprehension. By the way doesn’t the original problem say exclude multiples of 15? IMO Python’s ge
by kccqzy 9y ago
You can do the same in Python, which steals Haskell’s list comprehension.
By the way doesn’t the original problem say exclude multiples of 15?
IMO Python’s generators and coroutines are one of its most useful yet least appreciated features. Being able to suspend a function, resume it, get values from it, send values or exceptions to it is a highly powerful feature. You can use them to implement user-space cooperative threads, write a scheduler for that, implement message-passing concurrency, and do highly efficient multiplexed I/O in the style of asyncio.
- oldandtired 9y agoand Python got this from....? (which language)
- kccqzy 9y agoWell Python got it from Haskell. I thought I made it clear enough. See https://docs.python.org/3/howto/functional.html https://docs.python.org/3/howto/functional.html
- oldandtired 9y agoWell years ago, I saw a discussion that put this in the context of python's generators being inspired by what was in Icon.
- bunderbunder 9y agoI'm just now looking at Icon code for the first time, but, to me, Python's list comprehension syntax looks more similar to Haskell's than Icon's.