Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7801865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:04:42+00:00 2026-06-02T01:04:42+00:00

I have just started to learn the Play 2.0 Framework. The one thing I

  • 0

I have just started to learn the Play 2.0 Framework. The one thing I just can’t understand is the Iteratee, Enumerator and Enumeratee pattern described in the play tutorial. I have very little experience in functional languages.

What does this pattern accomplish?

How does it help me write non-blocking/reactive code?

some simple examples would help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T01:04:44+00:00Added an answer on June 2, 2026 at 1:04 am

    The playframework 2.0 download comes with some samples. Two of which have Iteratee/Comet examples. For instance, the comet-clock sample app shows:

    lazy val clock = Enumerator.fromCallback { () =>
      Promise.timeout(Some(dateFormat.format(new Date)), 100 milliseconds)
    }
    

    Then it is used like this:

    Ok.stream(clock &> Comet(callback = "parent.clockChanged"))
    

    Which will feed the result to the client in chunks. The Enumerator object also has a fromFile, fromStream (as in java.io.InputStream) utility enumerator functions.

    I am not sure where this is done but the assumption is that this chunked processing is not tying up threads. It would be very interesting to see some benchmarks, as there is certainly overhead in the implementation of iteratees as the data to be processed as well as the computation is wrapped in various objects.

    Data that is fed from an enumerator is wrapped so that it can indicates there is more data to process or the data has reached the end (EOF). Processing results of iteratees are also wrapped so that it can indicate whether a result has been computed on some input or more input is needed to compute a result. I recommend John De Goes’ nescala presentation that shows the evolution from a fold to Iteratees. Edit: Brendan McAdams has a nice Scala Days 2012 presentation on Async and non-blocking – towards the end of the presentation (~26min) it touches on iteratees and how it helps with processing database cursor style IO in async style.

    One touted benefit of Iteratees is that they compose. Here are a few ways they compose:

    • you can feed an enumator andThen another
    • you can map a function of type (T) => U over an enumerator of T to get an enumerator of U
    • you can interleave two enumerators
    • an iteratee can leave some input to be consumed by another iteratee
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started to learn objective-c and one thing is not clear for me
I have just started to learn Ruby and got a good take on the
I just have started to learn Haskell and combine reading books and tutorials with
I've just started to learn about tie . I have a class named Link
I have just started to learn the very basics of Java programming. Using a
I have just started to learn about the pros of foreign keys in database
I have just started to learn the basics of Blackberry.... So, I am facing
I have just started to learn ASP.NET MVC. When comparing ASP.NET MVC with Web
I have just started to learn Scala. I was looking for something in line
I have just started to learn Haskell out of interest. I follow learnyouahaskell.com .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.