Remove duplicate elements: Difference between revisions
Content added Content deleted
(→{{header|Pascal}}: add example) |
|||
Line 67: | Line 67: | ||
The list contains atoms and also a few non-atomic expressions. The hash table needs atomic keys, so we apply the <code>str</code> function when searching and inserting elements. |
The list contains atoms and also a few non-atomic expressions. The hash table needs atomic keys, so we apply the <code>str</code> function when searching and inserting elements. |
||
<lang>2 3 5 7 11 13 17 19 cats 222 (-100.2) "+11" (1.1) "+7" (7.) 7 5 5 3 2 0 (4.4) 2:?LIST |
<lang bracmat>2 3 5 7 11 13 17 19 cats 222 (-100.2) "+11" (1.1) "+7" (7.) 7 5 5 3 2 0 (4.4) 2:?LIST |
||
(A= |
(A= |
||
Line 131: | Line 131: | ||
)</lang> |
)</lang> |
||
Only solution B produces a list with the same order of elements as in the input. |
Only solution B produces a list with the same order of elements as in the input. |
||
< |
<pre>Solution A: 19 (4.4) 17 11 13 (1.1) (7.) 222 +11 7 5 3 2 0 cats (-100.2) +7 |
||
Solution B: 11 13 17 19 cats 222 (-100.2) +11 (1.1) +7 (7.) 7 5 3 0 (4.4) 2 |
Solution B: 11 13 17 19 cats 222 (-100.2) +11 (1.1) +7 (7.) 7 5 3 0 (4.4) 2 |
||
Solution C: (7.) (4.4) (1.1) (-100.2) cats 222 19 17 13 11 7 5 3 2 0 +7 +11</ |
Solution C: (7.) (4.4) (1.1) (-100.2) cats 222 19 17 13 11 7 5 3 2 0 +7 +11</pre> |
||
=={{header|Brat}}== |
=={{header|Brat}}== |