Return to CLIP Main Page
Next: Constraint Logic Programming: Conditionals/Choices
Up: Document: europar97_sl
Previous: Constraint Logic Programming: Variables
- Procedure abstraction (not unlike ``call by reference''):
0.430.43
|
main :- | foo(K,W), |
|
| K = 3, |
|
| write(W). |
- Y local variable; Z,X formal parameters.
- Calling foo(3,W) adds W=5 to calling context.
- But different ``calling modes'' allowed:
- Calling foo(K,5) adds K=3 to calling context.
- Calling foo(K,W) adds W=2+K to calling context
(e.g., main above prints ``5'').
- Can be seen as ``reversible'' versions of their imperative
syntactic counterparts.
- Procedures define a relation (rather than a function) among arguments.
<herme at fi.upm.es>-<webmaster@clip.dia.fi.upm.es> Last updated on Wed Dec 3 16:57:50 MET 1997