Remove duplicate elements: Difference between revisions
Content deleted Content added
m →{{header|Go}}: reference associative arrays task |
|||
Line 540: | Line 540: | ||
fmt.Println(uniq([]int {1,2,3,2,3,4})) // prints: [3 1 4 2] |
fmt.Println(uniq([]int {1,2,3,2,3,4})) // prints: [3 1 4 2] |
||
}</lang> |
}</lang> |
||
replace "int" with another type |
replace "int" with another type to use for a list of another type. (See [[Associative_arrays/Creation#Go]] for acceptable types.) |
||
It takes only small changes to the above code to preserver order. Just store the sequence in the map: |
It takes only small changes to the above code to preserver order. Just store the sequence in the map: |