Skip to main content
Log in

Combinator evaluation of functional programs with logical variables

  • Published:
LISP and Symbolic Computation

Abstract

A technique is presented that brings logical variables into the scope of the well-known Turner method for normal order evaluation of functional programs by S, K, I combinator graph reduction. This extension is illustrated bySASL+LV, an extension of Turner's languageSASL in which arbitrary expressions serve as formal parameters, and parameter passage is done by unification. The conceptual and practical advantages of such an extension are discussed, as well as semantic pitfalls that arise from the attendant weakening of referential transparency. Only five new combinators (LV, BV, FN, FB and UNIFY) are introduced. The resulting object code is fully upward compatible in the sense that previously compiledSASL programs remain executable with unchanged semantics. However,read-only variable usage inSASL+LV programs requires amultitasking extension of the customary stack-based evaluation method. Mechanisms are presented for managing this multitasking on both single and multiprocessor systems. Finally, directions are mentioned for applying this technique to implementations involving larger granularity combinators, and fuller semantic treatment of logical variables (e.g. accommodation of failing unifications).

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

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Ali, K. M. and Haridi, S. Global garbage collection for distributed heap storage systems.International Journal of Parallel Programming, 15, 35 (October 1987) 339–387.

    Google Scholar 

  2. Ariola, Zena and Arvind. P-TAC: a parallel intermediate language. In MacQueen, David, editor,Proc. Conf. on Functional Programming Languages and Computer Architectures, London, Springer Verlag (1989).

    Google Scholar 

  3. Arvind, Kathail, Vinod, and Pingali, Keshav. Sharing of computation in functional language implementations. InProceedings of International Workshop on High-level Computer Architecture, Los Angeles (May 21–25 1984).

  4. Arvind, Nikhil, Rishiyur S., and Pingali, Keshav K. I-structures: data structures for parallel computing.ACM Transactions on Programming Languages and Systems, 11, 4 (October 1989) 598–632.

    Google Scholar 

  5. Båge, Göran and Lindstrom, Gary. Committed choice functional programming. InProc. International Conference on Fifth Generation Computer Systems, Institute for New Generation Computer Technology (ICOT), Tokyo (November 1988) 666–674.

    Google Scholar 

  6. Burton, F. W. Speculative computation, parallelism and functional programming.IEEE Transactions on Computers, C-34, 12 (1985) 1190–1193.

    Google Scholar 

  7. Camilleri, Albert, Gordon, Michael C., and Melham, Tom. Hardware specification and verification using higher order logic. In Borrione, Dominique, editor,Proceedings of the IFIP Working conference “From HDL Descriptions to Guaranteed Correct Circuit Designs”, North-Holland, Grenoble, France (1987).

    Google Scholar 

  8. Clack, C. and Peyton Jones, S. L. Generating parallelism from strictness analysis. InProc. Conf. on Func. Prog. Lang. and Comp. Arch., IFIP, Nancy, France (September 1985). Lecture Notes in Computer Science, number 201.

    Google Scholar 

  9. Clarke, T. J. W., Gladstone, P. J. S., Maclean, C. D., and Norman, A. C. SKIM — the S, K, I reduction machine. InProc. Symp. on Lisp and Func. Pgmming. and Computer Architectures, ACM (1980) 128–135.

  10. Cohen, Jacques and Hickey, Timothy. Parsing and compiling using Prolog.ACM Transactions on Programming Languages and Systems, 9, 2 (1987) 125–163.

    Google Scholar 

  11. Curry, H. B. and Feys, R.Combinatory Logic. Volume 1, North Holland (1958).

  12. Danforth, S. H.Logical Variables for a Functional Language. Technical Report PP-120-85, Microelectronics and Computer Technology Corp. (1985).

  13. Davison, Andrew. Blackboard systems in Polka.International Journal of Parallel Programming, 16, 5 (October 1987) 401–424.

    Google Scholar 

  14. Debray, Saumya K. and Warren, David S. Automatic mode inference for Prolog programs. In Keller, Robert M., editor,Symposium on Logic Programming, IEEE Computer Society, Salt Lake City (September 1986) 78–88.

    Google Scholar 

  15. Deutsch, L. P. and Bobrow, D. G. An efficient incremental automatic garbage collector.Communications of the ACM, 9, 9 (1966) 522–526.

    Google Scholar 

  16. Goldberg, B. and Hudak, P. Serial combinators: optimal grains of parallelism. InProc. Conf. on Functional Programming Languages and Computer Architectures, Springer Verlag, Nancy, France (1985) 382–399. Lecture Notes in Computer Science, number 201.

    Google Scholar 

  17. Haridi, A. Seif.Logic Programming Based on a Natural Deduction System. PhD thesis, Royal Institute of Technology (1981).

  18. Hughes, John. Super combinators: a new implementation method for applicative languages. InProc. Symp. on Lisp and Func. Pgmming. and Computer Architectures, ACM, Pittsburgh, Pa. (1982) 1–10.

    Google Scholar 

  19. Hughes, J. Lazy memo-functions. InProc. Conf. on Func. Prog. Lang. and Comp. Arch., IFIP, Nancy, France (September 1985).

    Google Scholar 

  20. Hughes, J. A simple implementation of concurrent graph reduction. In Keller, R. M. and Fasel, J., editors,Proc. Santa Fe Workshop on Graph Reduction, Springer-Verlag (1987). Lecture Notes in Computer Science 279.

  21. Jagadeesan, Radha, Panangaden, Prakash, and Pingali, Keshav. A fully abstract semantics for a functional language with logical variables. InProc. of Symposium on Logic in Computer Science (1989).

  22. Johnsson, T. Efficient compilation of lazy evaluation. InProc. Symp. on Compiler Const., ACM SIGPLAN, Montreal (1984).

    Google Scholar 

  23. Kahn, K., Tribble, E. D., Miller, M. S., and Bobrow, D. G. Objects in concurrent object programming systems. InProc. OOPSLA '86, Portland, OR (1986) 242–257.

  24. Keller, R. M. and Lin, F. C. H. Simulated performance of a reduction-based multiprocessor.IEEE Computer, 17, 7 (July 1984) 70–82.

    Google Scholar 

  25. Keller, R. M., Jayaraman, B., Rose, D., and Lindstrom, G.FGL (Function Graph Language) Programmers' Guide. Technical Report AMPS Technical Memorandum No. 1, University of Utah, Computer Science Department (July 1980).

  26. Kieburtz, R. B. The G machine: a fast graph-reduction evaluator. InProc. Conf. on Functional Programming Languages and Computer Architectures, Nancy, France, Springer Verlag (1985) 400–413. Lecture Notes in Computer Science, number 201.

    Google Scholar 

  27. Kieburtz, Richard B. Semantics of a functions + logic language. (September 3, 1986). 17 pp. unpublished paper.

  28. Kieburtz, Richard B: When chasing your tail saves time.Information Processing Letters, 23 (December 1986) 321–324.

    Google Scholar 

  29. Kieburtz, Richard B.Functions + Logic in Theory and Practice. technical report CSE-87-002, Oregon Graduate Institute (February 25, 1987 (revised June, 1988)). 21 pp.

  30. Kuo, T.-M. and Mishra, P. On strictness and its analysis. InProc. Symp. on Princ. of Pgmming. Lang., ACM, Munich, West Germany (March 1987).

    Google Scholar 

  31. Lindstrom, Gary. Scanning list structures without stacks or tag bits.Information Processing Letters, 2 (1973) 47–51.

    Google Scholar 

  32. Lindstrom, G. OR-parallelism on applicative architectures. InProc. 2nd Int'l. Logic Programming Conf., Uppsala University (July 1984) 159–170.

  33. Lindstrom, G. Functional programming and the logical variable. InProc. Symp. on Princ. of Pgmming. Lang., ACM, New Orleans (January 1985) 266–280. Also available as INRIA Rapport de Recherche No. 357.

    Google Scholar 

  34. Lindstrom, G. Implementing logical variables on a graph reduction architecture. In Keller, R. M. and Fasel, J., editors,Proc. Santa Fe Workshop on Graph Reduction, Springer-Verlag (1987) 382–400. Lecture Notes in Computer Science 279.

  35. Lindstrom, Gary. Static analysis of functional programs with logical variables. InProc. International Workshop on Programming Language Implementation and Logic Programming (PLILP '88), Springer Lecture Notes in Computer Science Number 348, Orleans, France (1989) 1–19.

  36. Lindstrom, G., George, L., and Yeh, D. Generating efficient code from strictness annotations. InTAPSOFT'87: Proc. Second International Joint Conference on Theory and Practice of Software Development, Pisa, Italy (March 1987) 140–154. Springer Lecture Notes in Computer Science No. 250.

  37. Mantha, Surya, George, Lal, and Lindstrom, Gary. A denotational semantics for a lazy functional language with logical variables. (December 1989). Unpublished 11 pp. technical summary.

  38. Milner, R. A theory of type polymorphism.J. of Comp. and Sys. Sci., 17, 3 (1978) 348–375.

    Google Scholar 

  39. Nikhil, R. S.Id World Reference Manual (for Lisp Machines). Technical Report Computation Structures Group Memo, MIT Laboratory for Computer Science (April 24, 1987).

  40. Patel, Dorab, Schlag, Martine, and Ercegovac, Miloš.vFP, an environment for the multi-level specification, analysis and synthesis of hardware algorithms. InProc. Conf. on Functional Programming Languages and Computer Architectures, Springer Verlag, Nancy, France (1985) 238–255. Lecture Notes in Computer Science, number 201.

    Google Scholar 

  41. Reddy, U.S. On the relationship between functional and logic languages. In DeGroot, D. and Lindstrom, G., editors,Logic Programming: Functions, Relations, and Equations, Prentice Hall (1986).

  42. Saraswat, Vijay A. A somewhat logical formulation of CLP synchronization primitives. In Kowalski, Robert A. and Bowen, Kenneth A., editors,Logic Programming: Proceedings of the Fifth International Conference and Symposium, MIT Press, Seattle (1988) 1298–1314.

    Google Scholar 

  43. Scheevel, Mark. Norma: a graph reduction processor. InProc. Symp. on Lisp and Func. Pgmming., ACM, Cambridge, MA (1986) 212–219.

    Google Scholar 

  44. Schorr, H. and Waite, W. M. An efficient machine-independent procedure for garbage collection in various list structures.Communications of the ACM, 10, 8 (1967) 501–506.

    Google Scholar 

  45. Scott, Dana. Domains for denotational semantics. InInternational Conference on Foundations of Programming Languages, Springer-Verlag Lecture Notes in Computer Science 140 (1982) 577–613.

    Google Scholar 

  46. Shapiro, E.Y.A Subset of Concurrent Prolog and Its Interpreter. Technical Report TR-003, Institute for New Generation Computer Technology (January 1983).

  47. Shapiro, Ehud. Concurrent Prolog: a progress report.IEEE Computer, 19, 8 (August 1986) 44–58.

    Google Scholar 

  48. Sheeran, Mary. Designing regular array architectures using higher order functions. InProc. Conf. on Functional Programming Languages and Computer Architectures, Springer Verlag, Nancy, France (1985) 220–237. Lecture Notes in Computer Science, number 201.

    Google Scholar 

  49. Stroustrup, Bjarne. A set of C++ classes for co-routine style programming. (1985). Appendix toUNIX (tm) System V C++ Translator Release Notes.

  50. Tinker, P. and Lindstrom, G. A performance oriented design for OR-parallel logic programming. In Lassez, Jean-Louis, editor,Proc. International Conference on Logic Programming, MIT Press, Melbourne, Australia (May 1987) 601–615.

    Google Scholar 

  51. Turner, D. A. A new implementation technique for applicative languages.Software Practice and Experience, 9 (1979) 31–49.

    Google Scholar 

  52. Turner, David A. Miranda: a non-strict functional language with polymorphic types. In Journannaud, J.-P., editor,Proc. Symp. on Functional Programming Languages and Computer Architectures, Springer-Verlag (1985) 1–16.

  53. Yeh, Dowming and Lindstrom, Gary. Polymorphic typing and strictness analysis. (November 1989). Unpublished 12 pp. technical summary.

Download references

Author information

Authors and Affiliations

Authors

Additional information

Research was supported in part by the Marcus Wallenberg Foundation.

Research supported in part by grant CCR-8704778 from the National Science Foundation, and by an unrestricted gift from Telefonaktiebolaget LM Ericsson, Stockholm.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Båge, G., Lindstrom, G. Combinator evaluation of functional programs with logical variables. Lisp and Symbolic Computation 3, 289–320 (1990). https://doi.org/10.1007/BF01806101

Download citation

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF01806101

Keywords

Navigation