Higher-Order Reactive Programming with Incremental Lists

  • Ingo Maier
  • Martin Odersky
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7920)


Reactive programming with first class time-varying values as in Functional Reactive Programming (FRP) is a powerful paradigm for designing and implementing event-based applications. Existing implementations deal with simple values. Time-varying collections can only propagate whether they have changed or not but not what has changed. This is inefficient compared to fine-grained callback driven logic that propagates incremental changes. In this work, we present a framework, Scala.React, with reactive abstractions for event streams, time-varying values as well as an incremental reactive list. Our reactive lists support both first-order reactivity by means of composition similar to functional collections via |map|, |filter|, |fold| and alike, as well as higher-order reactivity with support for time-varying collection elements. The framework automatically propagates incremental changes and guarantees strong data consistency. We show in examples that our system is convenient to use and performs well.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Acar, U.A., Blelloch, G., Ley-Wild, R., Tangwongsan, K., Turkoglu, D.: Traceable data types for self-adjusting computation. In: PLDI (2010)Google Scholar
  2. 2.
    Acar, U.A., Blelloch, G.E., Harper, R.: Adaptive functional programming. ACM Trans. Program. Lang. Syst. (2006)Google Scholar
  3. 3.
    Bhatotia, P., Wieder, A., Rodrigues, R., Acar, U.A., Pasquin, R.: Incoop: Mapreduce for incremental computations. In: SOCC (2011)Google Scholar
  4. 4.
    Burckhardt, S., Baldassin, A., Leijen, D.: Concurrent programming with revisions and isolation types. In: OOPSLA (2010)Google Scholar
  5. 5.
    Burckhardt, S., Leijen, D., Sadowski, C., Yi, J., Ball, T.: Two for the price of one: A model for parallel and incremental computation. In: OOPSLA (2011)Google Scholar
  6. 6.
    Ceri, S., Widom, J.: Deriving production rules for incremental view maintenance. In: VLDB (1991)Google Scholar
  7. 7.
    Cooper, G.H., Adsul, B.: Embedding dynamic dataflow in a call-by-value language. In: Sestoft, P. (ed.) ESOP 2006. LNCS, vol. 3924, pp. 294–308. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  8. 8.
    El-sayed, M.F., Mani, M., Shanmugasundaram, J.: Incremental maintenance of materialized XQuery views. In: ICDE (2006)Google Scholar
  9. 9.
    Elliott, C., Hudak, P.: Functional reactive animation. In: ICFP (1997)Google Scholar
  10. 10.
    Fegaras, L., Maier, D.: Optimizing object queries using an effective calculus. ACM Trans. Database Syst. (2000)Google Scholar
  11. 11.
    Georges, A., Buytaert, D., Eeckhout, L.: Statistically rigorous java performance evaluation. In: OOPSLA (2007)Google Scholar
  12. 12.
    Gluche, D., Grust, T., Mainberger, C., Scholl, M.H.: Incremental updates for materialized OQL views. In: Bry, F. (ed.) DOOD 1997. LNCS, vol. 1341, pp. 52–66. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  13. 13.
    Griffin, T., Libkin, L.: Incremental maintenance of views with duplicates. ACM SIGMOD (1995)Google Scholar
  14. 14.
    Gupta, A., Mumick, I.S.: Maintenance of materialized views: Problems, techniques, and applications. Materialized Views (1999)Google Scholar
  15. 15.
    Hinze, R., Paterson, R.: Finger trees: a simple general-purpose data structure. Journal of Functional Programming (2006)Google Scholar
  16. 16.
    Hudak, P., Courtney, A., Nilsson, H., Peterson, J.: Arrows, robots, and functional reactive programming (2002)Google Scholar
  17. 17.
    Lee, K.Y., Son, J.H., Kim, M.H.: Efficient incremental view maintenance in data warehouses. In: CIKM (2001)Google Scholar
  18. 18.
    Liu, Y.A., Stoller, S.D., Gorbovitski, M., Rothamel, T., Liu, Y.E.: Incrementalization across object abstraction. In: OOPSLA (2005)Google Scholar
  19. 19.
    Maier, I., Odersky, M.: Deprecating the observer pattern in Scala.React. Technical report, EPFL Lausanne (2012)Google Scholar
  20. 20.
    Meijer, E., Fokkinga, M., Paterson, R.: Functional programming with bananas, lenses, envelopes and barbed wire. In: Hughes, J. (ed.) FPCA 1991. LNCS, vol. 523, Springer, Heidelberg (1991)CrossRefGoogle Scholar
  21. 21.
    Meyerovich, L.A., Guha, A., Baskin, J., Cooper, G.H., Greenberg, M., Bromfield, A., Krishnamurthi, S.: Flapjax: A programming language for ajax applications. In: OOPSLA (2009)Google Scholar
  22. 22.
    Morrison, D.R.: PATRICIA-Practical algorithm to retrieve information coded in alphanumeric. J. ACM (1968)Google Scholar
  23. 23.
    Nilsson, H., Courtney, A., Peterson, J.: Functional reactive programming, continued. In: Haskell (2002)Google Scholar
  24. 24.
    Prokopec, A., Bagwell, P., Rompf, T., Odersky, M.: A generic parallel collection framework. In: ICPP (2011)Google Scholar
  25. 25.
    Steele Jr., G.L.: Organizing functional code for parallel execution or, foldl and foldr considered slightly harmful. In: ICFP (2009)Google Scholar
  26. 26.
    Sutherland, I.E.: Sketchpad: A man-machine graphical communication system. In: DAC (1964)Google Scholar
  27. 27.
    Willis, D., Pearce, D.J., Noble, J.: Caching and incrementalisation in the Java query language. ACM Sigplan Notices (2008)Google Scholar
  28. 28.
    Zanden, B.T.V., Halterman, R., Myers, B.A., Mcdaniel, R., Miller, R., Szekely, P., Giuse, D.A., Kosbie, D.: Lessons learned about one-way, dataflow constraints in the Garnet and Amulet graphical toolkits (2001)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Ingo Maier
    • 1
  • Martin Odersky
    • 1
  1. 1.EPFLSwitzerland

Personalised recommendations