Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> you can create a value just like any other iterable sequence that happens to be a generator for the infinite series of integers...

I know that. Almost every language out there has some kind of generator/iterator protocol for "lazy" sequences. But they're not a list like any other list out there. You can (usually) iterate through them only once.

And you can't apply a generator/iterator type of deal to, say, a tree structure or any other non-linear data structure.

In Haskell, every value works like that (unless you explicitly tell otherwise). This is what the "primes" example is trying to show.



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

Search: