Skip to content

Instantly share code, notes, and snippets.

@nowelium
Created May 5, 2010 08:00
Show Gist options
  • Save nowelium/390513 to your computer and use it in GitHub Desktop.
Save nowelium/390513 to your computer and use it in GitHub Desktop.
Stream := Object clone do (
create := method(car, cdr,
stream := self clone
stream setSlot("_car", car)
stream setSlot("_cdr", cdr)
stream
)
car := method(_car)
cdr := method(_cdr call)
each := method(_block,
_block call(car)
cdr each(_block)
)
)
@nowelium
Copy link
Author

nowelium commented May 5, 2010

Scala like Stream

usage

generateInteger := method(v,
    Stream create(v, block(generateInteger(v + 1)))
)

generateInteger(1) each(block(p, p println))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment