Claims
- 1. A method for composing programming abstractions, comprising:
defining a composition operation for composing a first abstraction and a second abstraction with a selected composition operator; each abstraction having a form, a prefix, and at least one expression; unfolding the expressions from the first and the second abstractions by: (a) removing the prefix of each abstraction, and (b) substituting formal parameter names in each expression with a common parameter name to define open variables; transforming the unfolded expressions to a reduced expression using a composition pattern that tunes semantics of the selected composition operator; selecting a prefix that depends on the selected composition operator and the form of the first abstraction and the second abstraction; the selected prefix having a formal parameter with a type; and nesting the reduced expression in a third abstraction that composes the first abstraction and the second abstraction by: (i) appending the selected prefix to the reduced expression, (ii) binding the open variables of the reduced expression to the formal parameter of the selected prefix, and (iii) computing the type of the formal parameter of the selected prefix.
- 2. The method according to claim 1, wherein the selected composition operator applies to operands that comprise at least one recursive functional abstraction.
- 3. The method according to claim 1, wherein the selected composition operator is as defined by:
- 4. The method according to claim 3, wherein the selected composition operator applies to operands that comprise at least one recursive functional abstraction.
- 5. The method according to claim 1, wherein the selected composition operator is as defined by:
- 6. The method according to claim 1, wherein the selected composition operator is as defined by:
- 7. The method according to claim 1, wherein the selected composition operator is as defined by:
- 8. The method according to claim 7, wherein the selected composition operator applies to a recursive nabla abstraction.
- 9. The method according to claim 1, wherein the selected composition operator is as defined by:
- 10. The method according to claim 9, wherein the selected composition operator applies to a recursive nabla abstraction.
- 11. An apparatus for composing programming abstractions, comprising:
means for defining a composition operation for composing a first abstraction and a second abstraction with a selected composition operator; each abstraction having a form, a prefix, and at least one expression; means for unfolding the expressions from the first and the second abstractions by: (a) removing the prefix of each abstraction, and (b) substituting formal parameter names in each expression with a common parameter name to define open variables; means for transforming the unfolded expressions to a reduced expression using a composition pattern that tunes semantics of the selected composition operator; means for selecting a prefix that depends on the selected composition operator and the form of the first abstraction and the second abstraction; the selected prefix having a formal parameter with a type; and means for nesting the reduced expression in a third abstraction that composes the first abstraction and the second abstraction by: (i) appending the selected prefix to the reduced expression, (ii) binding the open variables of the reduced expression to the formal parameter of the selected prefix, and (iii) computing the type of the formal parameter of the selected prefix.
- 12. The apparatus according to claim 11, wherein the selected composition operator applies to operands that comprise at least one recursive functional abstraction.
- 13. The apparatus according to claim 11, wherein the selected composition operator is as defined by:
- 14. The apparatus according to claim 13, wherein the selected composition operator applies to operands that comprise at least one recursive functional abstraction.
- 15. The apparatus according to claim 11, wherein the selected composition operator is as defined by:
- 16. The apparatus according to claim 11, wherein the selected composition operator is as defined by:
- 17. The apparatus according to claim 11, wherein the selected composition operator is as defined by:
- 18. The apparatus according to claim 11, wherein the selected composition operator is a as defined by:
- 19. An article of manufacture for use in a machine, comprising:
a memory; instructions stored in the memory for composing programming abstractions comprising: defining a composition operation for composing a first abstraction and a second abstraction with a selected composition operator; each abstraction having a form, a prefix, and at least one expression; unfolding the expressions from the first and the second abstractions by: (a) removing the prefix of each abstraction, and (b) substituting formal parameter names in each expression with a common parameter name to define open variables; transforming the unfolded expressions to a reduced expression using a composition pattern that tunes semantics of the selected composition operator; selecting a prefix that depends on the selected composition operator and the form of the first abstraction and the second abstraction; the selected prefix having a formal parameter with a type; and nesting the reduced expression in a third abstraction that composes the first abstraction and the second abstraction by: (i) appending the selected prefix to the reduced expression, (ii) binding the open variables of the reduced expression to the formal parameter of the selected prefix, and (iii) computing the type of the formal parameter of the selected prefix.
- 20. The article of manufacture according to claim 19, wherein the selected composition operator applies to operands that comprise at least one recursive functional abstraction.
CROSS-REFERENCE TO RELATED APPLICATIONS
[0001] Cross-reference is made to U.S. patent application Ser. Nos. 10/046,314, entitled “Symmetrical Structural Pattern Matching”, 10/046,191 entitled “Bi-Valuation Of Programming Statements”, which are assigned to the same assignee as the present invention and incorporated herein by reference. Cross-reference is also made to U.S. patent application filed concurrently herewith and entitled “Program Compiler With Abstraction Composer”, which is assigned to the same assignee as the present invention and incorporated herein by reference.