Skip to main content

The Practice of a Compositional Functional Programming Language

  • Conference paper
  • First Online:
Programming Languages and Systems (APLAS 2018)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 11275))

Included in the following conference series:

Abstract

Function composition is a very natural operation, but most language paradigms provide poor support for it. Without linguistic support programmers must work around or manually implement what would be simple compositions. The Kihi language uses only composition, makes all state visible, and reduces to just six core operations. Kihi programs are easily stepped by textual reduction but provide a foundation for compositional design and analysis.

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

Access this chapter

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 EPUB and 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

Institutional subscriptions

References

  1. Curry, H.B.: Grundlagen der kombinatorischen logik. Am. J. Math. 52(3), 509–536 (1930)

    Article  MathSciNet  Google Scholar 

  2. Erb, J.: Om programming language web site. https://sparist.github.io/Om/

  3. Felleisen, M., Findler, R.B., Flatt, M.: Semantics Engineering with PLT Redex. MIT Press, Cambridge (2009)

    MATH  Google Scholar 

  4. Frenger, P.: The JOY of forth. SIGPLAN Not. 38(8), 15–17 (2003). https://doi.org/10.1145/944579.944583

    Article  Google Scholar 

  5. Homer, M., Noble, J.: A tile-based editor for a textual programming language. In: VISSOFT 2013, pp. 1–4, September 2013. https://doi.org/10.1109/VISSOFT.2013.6650546

  6. Homer, M., Bruce, K.B., Noble, J., Black, A.P.: Modules as gradually-typed objects. In: DYLA 2013. ACM (2013). https://doi.org/10.1145/2489798.2489799

  7. Jones, T., Homer, M., Noble, J.: Brand objects for nominal typing. In: ECOOP 2015. LIPIcs, Dagstuhl, Germany, vol. 37, pp. 198–221 (2015). https://doi.org/10.4230/LIPIcs.ECOOP.2015.198

  8. Jones, T., Homer, M., Noble, J., Bruce, K.: Object inheritance without classes. In: ECOOP 2016. LIPIcs, Dagstuhl, Germany , vol. 56, pp. 13:1–13:26 (2016). https://doi.org/10.4230/LIPIcs.ECOOP.2016.13

  9. Krivine, J.L.: A call-by-name lambda-calculus machine. Higher Order Symbol. Comput. 20(3), 199–207 (2007). https://doi.org/10.1007/s10990-007-9018-9

    Article  MathSciNet  MATH  Google Scholar 

  10. Moore, C.: 1x Forth (1999)

    Google Scholar 

  11. Post, E.L.: Formal reductions of the general combinatorial decision problem. Am. J. Math. 65(2), 197–215 (1943)

    Article  MathSciNet  Google Scholar 

  12. von Thun, M., Thomas, R.: Joy: forth’s functional cousin. In: Proceedings of the 17th EuroForth Conference (2001)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Michael Homer .

Editor information

Editors and Affiliations

Screenshots and Outline

Screenshots and Outline

This appendix provides tool screenshots, identifies various features, and notes points of behaviour that are incorporated in the demonstration.

1.1 Overall View of Web Evaluator

figure b

The top row includes, from left to right:

  1. 1.

    A text box for entering a Kihi program to evaluate;

  2. 2.

    A button that executes the program;

  3. 3.

    A button that translates the given program into core operations, expanding binds and named terms;

  4. 4.

    A button that shrinks excess terms inside abstractions.

The second row provides buttons for the operator symbols. The third is the output area, showing the final result value of the program and any values emitted by the evaluation.

The check boxes, from left to right:

  1. 1.

    Select the leftmost available reduction (checked) or the rightmost available reduction (unchecked);

  2. 2.

    Enable evaluation of the program without clicking “Run”;

  3. 3.

    Remove values reaching the left-hand edge and move them to the output area;

  4. 4.

    Render operators as names (e.g. right) instead of symbols ();

  5. 5.

    Sugar outputted Church numerals into textual numbers;

  6. 6.

    Render operators using substitute ASCII symbols (e.g. :) instead of mathematical symbols (\(\mathtt {\times }\)). This mode suits some limited browsers and systems.

The step limit determines the maximum number of reduction steps the evaluator will take before stopping. It also stops if a program becomes too long. These stopping points are to preserve browser resources. In particular, programs with nested binds (as in the provided factorial example program) can expand to many thousands of terms of core Kihi, and creating the list of steps performs very poorly. This is a limitation of the web evaluator.

The fourth row allows manual stepping through the evaluation: jumping to a specific numbered step (left), dragging the slider through steps (middle), or automatically replaying and pausing evaluation (right).

The black box shows the current program being evaluated at this step, depicted and described in more detail in the next section.

The “Steps” heading shows the total number of steps, and acts to hide or restore the complete list of reduction steps below. The filter text box permits showing only a subset of steps: for example, entering “left” will make only “left” reduction steps appear.

The list of steps shows the program as it is at each step, underlining any new terms introduced at that step and marking the rule used to obtain them. Hovering the mouse over the rule will show a detailed display of the specific reduction. The terms to be reduced next are highlighted in blue; it is possible for portions of the program to be both new (underlined) and to-be-reduced (blue) at once. Clicking on a step jumps the display above to that step of the program.

A labelled list of sample programs is below, any of which can be loaded and evaluated by clicking the title.

1.2 Single-Step Display of Web Evaluator

figure c

The complete program at this step is displayed at the top, with the rule that produced it displayed below. The underlined text in the program is that on the right-hand side of the rule display, and blue text is the next to be expanded as before. The rule display highlights different elements of the rule (for example, arguments) and matches corresponding elements on each side with the same highlighting.

Rights and permissions

Reprints and permissions

Copyright information

© 2018 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Jones, T., Homer, M. (2018). The Practice of a Compositional Functional Programming Language. In: Ryu, S. (eds) Programming Languages and Systems. APLAS 2018. Lecture Notes in Computer Science(), vol 11275. Springer, Cham. https://doi.org/10.1007/978-3-030-02768-1_10

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-02768-1_10

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-02767-4

  • Online ISBN: 978-3-030-02768-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics