Comment

Comment by indspenceable

Re: Generators - I don't know why it's so hidden, but the Enumerator class allows you to make generators

```

enum = Enumerator.new{|y| a = 0; loop{y << a; a += 1}}

enum.next => 0

enum.next => 1

etc

```

I believe this has existed since 1.8x

parent indspenceable 11 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton