Abstract

This paper introduces a new logical form, called the sublist assertion, and shows its many uses for list processing, especially listless and lazy evaluation, features that are traditionally absent in programming languages such as Prolog. The basic technique involves the use of one or more sublist assertions for specifying the elements of a list-valued function, and also a new form of list-matching and unification for iterating over the elements of a list. A sublist assertion can take one of two forms: f (terms) ⊒ expression f (terms) ⊒ list :- condition When multiple sublist assertions define some given function f, the corresponding lists defined by their bodies are appended together; hence the order of sublist assertions is significant. Three types of goals are provided, each with a different operational effect: (i) f( terms) = answer defines answer to be list of all elements, and corresponds to eager evaluation; (ii) f( terms) ⊒ [answer] defines answer to be an element of the resulting list, and corresponds to listless evaluation, where intermediate lists are avoided; (iii) f( terms) ⊒ answer defines answer to be the list of all elements, but the elements are generated by lazy evaluation. The paper also discusses a novel list pattern, [ x t ], meaning that x is an element of the matching list and t is the remainder. It is shown that this facilitates clear, concise, and efficient list operations. The integration of the sublist assertion with relational assertions is also discussed, as it provides a way to define a listof operation (analogous to bagof) and also offers the benefits of lazy, nondeterministic evaluation.

Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.