Advertisement

Pull-Ups, Push-Downs, and Passing It Around

Exercises in Functional Incrementalization
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6041)

Abstract

Programs in languages such as Haskell are often datatype-centric and make extensive use of folds on that datatype. Incrementalization of such a program can significantly improve its performance by transforming monolithic atomic folds into incremental computations. Functional incrementalization separates the recursion from the application of the algebra in order to reduce redundant computations and reuse intermediate results. In this paper, we motivate incrementalization with a simple example and present a library for transforming programs using upwards, downwards, and circular incrementalization. Our benchmarks show that incrementalized computations using the library are nearly as fast as handwritten atomic functions.

Keywords

Application Programming Interface Type Class Binary Search Tree Redundant Computation Attribute Grammar 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Chakravarty, M.M.T., Keller, G., Peyton Jones, S.L., Marlow, S.: Associated Types with Class. In: POPL, pp. 1–13 (2005)Google Scholar
  2. 2.
    Hinze, R., Jeuring, J., Löh, A.: Type-indexed data types. Science of Computer Programming 51(1-2), 117–151 (2004)MathSciNetCrossRefzbMATHGoogle Scholar
  3. 3.
    Sheard, T., Peyton Jones, S.L.: Template Meta-programming for Haskell. In: Haskell, pp. 1–16 (2002)Google Scholar
  4. 4.
    Liu, Y.A.: Efficiency by Incrementalization: An Introduction. Higher-Order and Symbolic Computation 13(4), 289–313 (2000)MathSciNetCrossRefGoogle Scholar
  5. 5.
    Adams, S.: Functional Pearls: Efficient sets – a balancing act. J. of Functional Programming 3(04), 553–561 (1993)CrossRefGoogle Scholar
  6. 6.
    Claessen, K., Hughes, J.: QuickCheck: A Lightweight Tool for Random Testing of Haskell Programs. In: ICFP, pp. 268–279 (2000)Google Scholar
  7. 7.
    Knuth, D.E.: Semantics of context-free languages. Theory of Computing Systems 2(2), 127–145 (1968)MathSciNetzbMATHGoogle Scholar
  8. 8.
    Gibbons, J.: Upwards and downwards accumulations on trees. In: Bird, R.S., Woodcock, J.C.P., Morgan, C.C. (eds.) MPC 1992. LNCS, vol. 669, pp. 122–138. Springer, Heidelberg (1993)CrossRefGoogle Scholar
  9. 9.
    Huet, G.: The Zipper. J. of Functional Programming 7(05), 549–554 (1997)MathSciNetCrossRefzbMATHGoogle Scholar
  10. 10.
    Bird, R.S.: Using Circular Programs to Eliminate Multiple Traversals of Data. Acta Informatica 21(3), 239–250 (1984)CrossRefzbMATHGoogle Scholar
  11. 11.
    Swierstra, W.: Why Attribute Grammars Matter. The Monad .Reader 4 (2005)Google Scholar
  12. 12.
    Peyton Jones, S.L., Marlow, S., Elliott, C.: Stretching the storage manager: weak pointers and stable names in Haskell. In: Mohnen, M., Koopman, P. (eds.) IFL 2000. LNCS, vol. 2011, pp. 37–58. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  13. 13.
    Hinze, R.: Memo functions, polytypically! In: Jeuring, J. (ed.) WGP (2000)Google Scholar
  14. 14.
    van Noort, T., Rodriguez Yakushev, A., Holdermans, S., Jeuring, J., Heeren, B.: A lightweight approach to datatype-generic rewriting. In: WGP, pp. 13–24 (2008)Google Scholar
  15. 15.
    Rodriguez Yakushev, A., Holdermans, S., Löh, A., Jeuring, J.: Generic Programming with Fixed Points for Mutually Recursive Datatypes. In: ICFP, pp. 233–244 (2009)Google Scholar
  16. 16.
    Leather, S., Löh, A., Jeuring, J.: Pull-Ups, Push-Downs, and Passing It Around: Exercises in Functional Incrementalization. Technical Report UU-CS-2009-024, Dept. of Information and Computing Sciences, Utrecht University (November 2009)Google Scholar
  17. 17.
    Fokkinga, M.M., Jeuring, J., Meertens, L., Meijer, E.: A Translation from Attribute Grammars to Catamorphisms. The Squiggolist 2(1), 20–26 (1991)Google Scholar
  18. 18.
    Saraiva, J., Swierstra, S.D., Kuiper, M.: Functional Incremental Attribute Evaluation. In: Watt, D.A. (ed.) CC 2000. LNCS, vol. 1781, pp. 279–294. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  19. 19.
    Viera, M., Swierstra, S.D., Swierstra, W.: Attribute Grammars Fly First-Class: How to do Aspect Oriented Programming in Haskell. In: ICFP, pp. 245–256 (2009)Google Scholar
  20. 20.
    Jeuring, J.: Incremental algorithms on lists. In: van Leeuwen, J. (ed.) SION Conference on Computer Science in the Netherlands, pp. 315–335 (1991)Google Scholar
  21. 21.
    Carlsson, M.: Monads for incremental computing. In: ICFP, pp. 26–35 (2002)Google Scholar
  22. 22.
    Acar, U.A., Blelloch, G.E., Harper, R.: Adaptive functional programming. In: POPL, pp. 247–259 (2002)Google Scholar
  23. 23.
    Bernardy, J.P.: Lazy Functional Incremental Parsing. In: Haskell, pp. 49–60 (2009)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2010

Authors and Affiliations

  1. 1.Utrecht UniversityUtrechtThe Netherlands
  2. 2.Open Universiteit NederlandNetherlands

Personalised recommendations