Skip to content

Returning anonymous function does not always work #597

Answered by TimWhiting
chtenb asked this question in Q&A
Discussion options

You must be logged in to vote

The problem here is that calling stream/repeat returns a function and you want to call it still.

Try this:

pub fun stream/repeat(value : a) : (() -> <div,yield<a>> ())
  fn()
    yield(value)
    stream/repeat(value)()

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@chtenb
Comment options

Answer selected by chtenb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants