Skip to main content

Lingua Franca of Functional Programming (FP)

  • Conference paper

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 7829))

Abstract

Scheme is a minimalist language that brings its ancestor, LISP, on par with modern languages such as *ML and Haskell. Although it has very different tools in its repertoire (e.g., homoiconicity), many of the same techniques applied in other languages are also quite usable in Scheme. Some of them (e.g., pattern-matching, monadic and multi-stage programming, a notation for laziness) tend to be associated with other languages (primarily: Haskell and OCaml), and hence many programmers liking these constructs are drawn away from Scheme.

The concrete reason for this in FP community is the perceived verbosity of Scheme, while others (in particular, from the embedded community) have troubles adopting the more difficult concepts of FP in general. It is clear that there are approaches developed with FP that do help for productivity in hardware and software design. Transfer of this knowledge, however, is made difficult by an intellectual gap between the communities. In this paper we attempt to reconcile these two points of view by showing that (1) Scheme’s minimalistic but flexible approach can bring concrete benefits to the embedded community, and (2) none of these “advanced” features is particularly hard to replicate in a language such as Scheme. If one is willing to leverage Scheme’s hygienic macros, all of these features can be implemented separately as libraries and freely used together. No advanced compiler or interpreter modifications to implement such extensions are required for creating embedded DSLs in it.

To really see what Scheme (and homoiconicity) can bring to the domain of automated program construction, and to apply these ideas in practice to Software-Defined Radio (SDR) stacks, we have re-implemented a multi-staged, monadic FFT generator. In this paper we supplement it with a straightforward implementation of the C code-generation and Graphviz visualization back-ends and argue for a homoiconic, pure and total language to combine the best features of Scheme, Haskell and *ML.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Adams IV, N.I., Bartley, D.H., Brooks, G., Dybvig, R.K., Friedman, D.P., Halstead, R., Hanson, C., Haynes, C.T., Kohlbecker, E., Oxley, D., Pitman, K.M., Rozas, G.J., Steele Jr., G.L., Sussman, G.J., Wand, M., Abelson, H.: Revised5 report on the algorithmic language scheme. SIGPLAN Not. 33(9), 26–76 (1998)

    Article  Google Scholar 

  2. Alexandrescu, A.: Better template error messages. C/C++ Users J. 17(3), 37–47 (1999)

    Google Scholar 

  3. Bender, J.: sxml-match.ss. Internet

    Google Scholar 

  4. Calypto. Catapult c. Internet

    Google Scholar 

  5. Carette, J., Kiselyov, O.: Multi-stage programming with functors and monads: Eliminating abstraction overhead from generic code. Sci. Comput. Program. 76(5), 349–375 (2011)

    Article  MathSciNet  MATH  Google Scholar 

  6. Cohen, A., Donadio, S., Garzaran, M.-J., Herrmann, C., Kiselyov, O., Padua, D.: In search of a program generator to implement generic transformations for high-performance computing. Sci. Comput. Program. 62, 25–46 (2006)

    Article  MathSciNet  MATH  Google Scholar 

  7. Erwig, M.: Active patterns. In: Kluge, W.E. (ed.) IFL 1996. LNCS, vol. 1268, pp. 21–40. Springer, Heidelberg (1997)

    Chapter  Google Scholar 

  8. Filinski, A.: Representing monads. In: POPL, pp. 446–457 (1994)

    Google Scholar 

  9. Foltzer, A.C., Friedman, D.P.: A schemers view of monads. Partial draft (2011)

    Google Scholar 

  10. Forte, D.S.: Cynthesizer. Internet

    Google Scholar 

  11. Friedman, D., Hilsdale, E., Ganz, S., Dybvig, K.: match.ss. Internet

    Google Scholar 

  12. Gabriel, R.P.: The why of y. SIGPLAN Lisp Pointers 2(2), 15–25 (1988)

    Article  Google Scholar 

  13. Kiselyov, O.: Monadic programming in scheme. Internet (2005)

    Google Scholar 

  14. Kiselyov, O., Swadi, K.N., Taha, W.: A methodology for generating verified combinatorial circuits. In: Proceedings of the 4th ACM International Conference on Embedded Software, EMSOFT 2004, pp. 249–258. ACM, New York (2004)

    Google Scholar 

  15. Krishnamurthi, S.: Educational pearl: Automata via macros. J. Funct. Program. 16(3), 253–267 (2006)

    Article  MATH  Google Scholar 

  16. Lindley, S., Wadler, P., Yallop, J.: Idioms are oblivious, arrows are meticulous, monads are promiscuous. Electr. Notes Theor. Comput. Sci. 229(5), 97–117 (2011)

    Article  MathSciNet  Google Scholar 

  17. Meijer, E., Hutton, G.: Bananas in space: Extending fold and unfold to exponential types. In: FPCA, pp. 324–333 (1995)

    Google Scholar 

  18. Moggi, E.: Notions of computation and monads. Inf. Comput. 93(1), 55–92 (1991)

    Article  MathSciNet  MATH  Google Scholar 

  19. Queinnec, C.: Compilation of non-linear, second order patterns on s-expressions. In: Deransart, P., Małuszyński, J. (eds.) PLILP 1990. LNCS, vol. 456, pp. 340–357. Springer, Heidelberg (1990)

    Chapter  Google Scholar 

  20. Queinnec, C., Geffroy, P.: Partial evaluation applied to symbolic pattern matching with intelligent backtrack. In: WSA, pp. 109–117 (1992)

    Google Scholar 

  21. Rompf, T., Odersky, M.: Lightweight modular staging: a pragmatic approach to runtime code generation and compiled dsls. In: Visser, E., Järvi, J. (eds.) GPCE, pp. 127–136. ACM (2010)

    Google Scholar 

  22. Serrano, M., Weis, P.: Bigloo: A portable and optimizing compiler for strict functional languages. In: Mycroft, A. (ed.) SAS 1995. LNCS, vol. 983, pp. 366–381. Springer, Heidelberg (1995)

    Chapter  Google Scholar 

  23. Shinn, A.: match.scm. Internet

    Google Scholar 

  24. Siskind, J.M.: Flow-directed lightweight closure conversion. Technical Report 99-190R, NEC Research Institute, Inc. (1999)

    Google Scholar 

  25. Stroustrup, B.: The c++0x “remove concepts” decision. Internet

    Google Scholar 

  26. Sutton, A., Stroustrup, B.: Design of concept libraries for c++. In: Sloane, A., Aßmann, U. (eds.) SLE 2011. LNCS, vol. 6940, pp. 97–118. Springer, Heidelberg (2012)

    Chapter  Google Scholar 

  27. Swadi, K.N., Taha, W., Kiselyov, O., Pasalic, E.: A monadic approach for avoiding code duplication when staging memoized functions. In: Hatcliff, J., Tip, F. (eds.) PEPM, pp. 160–169. ACM (2006)

    Google Scholar 

  28. Tobin-Hochstadt, S.: Extensible pattern matching in an extensible language. CoRR, abs/1106.2578 (2011)

    Google Scholar 

  29. Tobin-Hochstadt, S., St-Amour, V., Culpepper, R., Flatt, M., Felleisen, M.: Languages as libraries. In: Hall, M.W., Padua, D.A. (eds.) PLDI, pp. 132–141. ACM (2011)

    Google Scholar 

  30. Wadler, P.: Comprehending monads. Mathematical Structures in Computer Science 2(4), 461–493 (1992)

    Article  MathSciNet  MATH  Google Scholar 

  31. Wright, A.K., Duba, B.F.: Pattern matching for scheme. Technical Report TX 77251-1892, Rice University (May 1995)

    Google Scholar 

  32. Yallop, J.: Ocaml patterns extesions. Internet

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2013 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Kourzanov, P., Sips, H. (2013). Lingua Franca of Functional Programming (FP). In: Loidl, HW., Peña, R. (eds) Trends in Functional Programming. TFP 2012. Lecture Notes in Computer Science, vol 7829. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-40447-4_13

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-40447-4_13

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-40446-7

  • Online ISBN: 978-3-642-40447-4

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics