Abstract
These notes present an introduction into array-based programming from a functional, i.e., side-effect-free perspective.
The first part focuses on promoting arrays as predominant, stateless data structure. This leads to a programming style that favors compositions of generic array operations that manipulate entire arrays over specifications that are made in an element-wise fashion. An algebraicly consistent set of such operations is defined and several examples are given demonstrating the expressiveness of the proposed set of operations.
The second part shows how such a set of array operations can be defined within the first-order functional array language SaC. It does not only discuss the language design issues involved but it also tackles implementation issues that are crucial for achieving acceptable runtimes from such genericly specified array operations.
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Allen, R., Kennedy, K.: Optimizing Compilers for Modern Architectures. Morgan Kaufmann Publishers, San Francisco (2001)
Sharp, I.P & Associates. SHARP APL Release 19.0 Guide for APL Programmers. I.P Sharp & Associates Ltd.(1987)
Benkard, J.P.: Extending Structure, Type, and Expression in APL-2. In: Proceedings of the International Conference on Array Processing Languages (APL 1991), Palo Alto, California, USA. APL Quote Quad, vol. 21, pp. 20–29. ACM Press, New York (1991)
Benkard, J.P.: Nested Arrays and Operators — Some Issues in Depth. In: Proceedings of the International Conference on Array Processing Languages (APL 1992), St.Petersburg, Russia. APL Quote Quad, pp. 7–21. ACM Press, New York (1992)
Bernecky, R.: An Introduction to Function Rank. In: Proceedings of the International Conference on Array Processing Languages (APL 1988), Sydney, Australia. APL Quote Quad, vol. 18, pp. 39–43. ACM Press, New York (1988)
Brown, J.: Inside the APL2 Workspace. SIGAPL Quote Quad 15, 277–282 (1985)
Burke, C.: J and APL. Iverson Software Inc., Toronto, Canada (1996)
Cann, D.C.: Compilation Techniques for High Performance Applicative Computation. Technical Report CS-89-108, Lawrence Livermore National Laboratory, LLNL, Livermore California (1989)
Cann, D.C.: Retire Fortran? A Debate Rekindled. Communications of the ACM 35(8), 81–89 (1992)
Cann, D.C.: The Optimizing SISAL Compiler: Version 12.0. Lawrence Livermore National Laboratory, LLNL, Livermore California, Part of the SISAL distribution (1993)
Chin, W.N.: Towards an Automated Tupling Strategy. In: Proceedings of the ACM SIGPLAN Symposium on Partial Evaluation and Semantic-Based Program Manipulation (PEPM 1997), Copenhagen, Denmark, pp. 119–132. ACM Press, New York (1993)
Chin, W.-N.: Safe Fusion of Functional Expressions II: Further Improvements. Journal of Functional Programming 4(4), 515–550 (1994)
Chin, W.N.: Fusion and Tupling Transformations: Synergies and Conflicts. In: Proceedings of the Fuji International Workshop on Functional and Logic Programming, Susono, Japan, pp. 106–125. World Scientific Publishing, Singapore (1995)
Chitil, O.: Type Inference Builds a Short Cut to Deforestation. In: Proceedings of the 1999 ACM SIGPLAN International Conference on Functional Programming (ICFP 1999), vol. 34(9), pp. 160–249. ACM Press, New York (1999)
Chakravarty, M.M.T., Keller, G.: Functional Array Fusion. In: Leroy, X. (ed.) Proceedings of ICFP 2001. ACM Press, New York (2001)
Chakravarty, M.M.T., Keller, G.: An Approach to Fast Arrays in Haskell. In: Jeuring, J., Jones, S.L.P. (eds.) AFP 2002. LNCS, vol. 2638, pp. 27–58. Springer, Heidelberg (2003)
Feo, J.T.: Arrays, Functional Languages, and Parallel Systems. In: Arrays in Sisal, ch. 5, pp. 93–106. Kluwer Academic Publishers, Dordrecht (1991)
Gill, A.: Cheap Deforestation for Non-strict Functional Languages. PhD thesis, Glasgow University (1996)
Grelck, C., Kreye, D., Scholz, S.-B.: On Code Generation for Multi-Generator WITH-Loops in SAC. In: Koopman, P., Clack, C. (eds.) IFL 1999. LNCS, vol. 1868, pp. 77–95. Springer, Heidelberg (2000)
Grelck, C.: Implicit Shared Memory Multiprocessor Support for the Functional Programming Language SAC - Single Assignment C. PhD thesis, Institut für Informatik und Praktische Mathematik, Universität Kiel (2001)
Grelck, C., Scholz, S.B.: HPF vs. SAC – A Case Study. In: Bode, A., Ludwig, T., Karl, W.C., Wismüller, R. (eds.) Euro-Par 2000. LNCS, vol. 1900, pp. 620–624. Springer, Heidelberg (2000)
Grelck, C., Scholz, S.B.: Axis Control in SaC. In: Peña, R., Arts, T. (eds.) IFL 2002. LNCS, vol. 2670, pp. 182–198. Springer, Heidelberg (2003)
Grelck, C., Scholz, S.-B., Trojahner, K.: WITH-Loop Scalarization – Merging Nested Array Operations. In: Trinder, P., Michaelson, G.J., Peña, R. (eds.) IFL 2003. LNCS, vol. 3145, pp. 118–134. Springer, Heidelberg (2004)
Hu, Z., Iwasaki, H.: Tupling Calculation Eliminates Multiple Data Traversals. In: Proceedings of the 2nd ICFP. ACM Press, New York (1997)
Herhut, S., Scholz, S.-B.: Towards Fully Controlled Overloading Across Module Boundaries. In: Grelck, C., Huch, F., Michaelson, G.J., Trinder, P. (eds.) IFL 2004. LNCS, vol. 3474, pp. 395–408. Springer, Heidelberg (2005)
Hui, R.: Rank and Uniformity. APL Quote Quad 25(4), 83–90 (1995)
International Standards Organization. International Standard for Programming Language APL. Iso n8485, ISO (1984)
Iverson, K.E.: A Programming Language. Wiley, New York (1962)
Iverson, K.E.: Programming in J. Iverson Software Inc., Toronto, Canada (1991)
Iverson, K.E.: J Introduction and Dictionary. Iverson Software Inc., Toronto, Canada (1995)
Jenkins, M.A., Falster, P.: Array Theory and NIAL. Technical Report 157, Technical University of Denmark, ELTEK, Lyngby, Denmark (1999)
Jenkins, M.A., Glasgow, J.I.: A Logical Basis for Nested Array Data Structures. Computer Languages Journal 14(1), 35–51 (1989)
Jenkins, M.A., Jenkins, W.H.: The Q’Nial Language and Reference Manuals. Nial Systems Ltd., Ottawa, Canada (1993)
Kreye, D.J.: A Compiler Backend for Generic Programming with Arrays. PhD thesis, Institut für Informatik und Praktische Mathematik, Universität Kiel (2003)
Lin, C.: ZPL Language Reference Manual. UW-CSE-TR 94-10-06, University of Washington (1996)
Lewis, E.C., Lin, C., Snyder, L.: The Implementation and Evaluation of Fusion and Contraction in Array Languages. In: Proceedings of the ACM SIGPLAN 1998 Conference on Programming Language Design and Implementation. ACM, New York (1998)
Restifo Mullin, L.M., Jenkins, M.: A Comparison of Array Theory and a Mathematics of Arrays. In: Arrays, Functional Languages and Parallel Systems, pp. 237–269. Kluwer Academic Publishers, Dordrecht (1991)
Restifo Mullin, L.M.: A Mathematics of Arrays. PhD thesis, Syracuse University (1988)
Nemeth, L., Peyton Jones, S.: A Design for Warm Fusion. In: Clack, C., Davie, T., Hammond, K. (eds.) Proceedings of the 10th International Workshop on Implementation of Functional Languages, pp. 381–393. University College, London (1998)
Peyton Jones, S.L., Wadler, P.: Imperative functional programming. In: POPL 1993. ACM Press, New Orleans (1993)
Scholz, S.-B.: Single Assignment C – Entwurf und Implementierung einer funktionalen C-Variante mit spezieller Unterstützung shape-invarianter Array-Operationen. PhD thesis, Institut für Informatik und Praktische Mathematik, Universität Kiel (1996)
Scholz, S.-B.: With-loop-folding in sac–Condensing Consecutive Array Operations. In: Clack, C., Hammond, K., Davie, T. (eds.) IFL 1997. LNCS, vol. 1467, pp. 72–92. Springer, Heidelberg (1998)
Scholz, S.-B.: A Type System for Inferring Array Shapes. In: Arts, T., Mohnen, M. (eds.) IFL 2002. LNCS, vol. 2312, pp. 65–82. Springer, Heidelberg (2002)
Scholz, S.-B.: Single Assignment C — efficient support for high-level array operations in a functional setting. Journal of Functional Programming 13(6), 1005–1059 (2003)
Shafarenko, A., Scholz, S.-B., Herhut, S., Grelck, C., Trojahner, K.: Implementing a Numerical solution of the KPI equation using single Assignment C: lessons and experiences. In: Butterfield, A., Grelck, C., Huch, F. (eds.) IFL 2005. LNCS, vol. 4015, pp. 160–177. Springer, Heidelberg (2006)
van Arkel, D., van Groningen, J., Smetsers, S.: Fusion in Practice. In: Peña, R., Arts, T. (eds.) IFL 2002. LNCS, vol. 2670, pp. 51–67. Springer, Heidelberg (2003)
van Groningen, J.: The Implementation and Efficiency of Arrays in Clean 1.1. In: Kluge, W. (ed.) IFL 1996. LNCS, vol. 1268, pp. 105–124. Springer, Heidelberg (1997)
Wolfe, M.J.: High-Performance Compilers for Parallel Computing. Addison-Wesley, Reading (1995)
Zima, H., Chapman, B.: Supercompilers for Parallel and Vector Computers. Addison-Wesley, Reading (1991)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2006 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Scholz, SB. (2006). Functional Array Programming in SaC . In: Horváth, Z. (eds) Central European Functional Programming School. CEFP 2005. Lecture Notes in Computer Science, vol 4164. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11894100_3
Download citation
DOI: https://doi.org/10.1007/11894100_3
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-46843-1
Online ISBN: 978-3-540-46845-5
eBook Packages: Computer ScienceComputer Science (R0)