Remove duplicate elements: Difference between revisions
→{{header|CafeOBJ}}
Line 958:
=={{header|CafeOBJ}}==
The parametrized module NO-DUP-LIST(ELEMENTS :: TRIV) defines the signature of
<lang> red (1 2 3 4) (3 2 1 5) .
--> (4 5 1 2 3):Int
Line 992:
The evaluation automatically uses right associativity. So starting with:
<lang> (1 1 2 1 1)</lang>
Line 1,000:
<lang> (1 ((1 2) (1 1))) </lang>
We get rewrite ''(1 1) -> 1'' . The term is now:
Line 1,006:
Any further occurrence of 1 will be removed.
We get rewrite ''(1 2) -> 2 ''. The term is now:
<lang>(1 (2 1))</lang>
|