Make Python List Unique in Functional way (map/reduce/filter)
dictionary, filter, functional-programming, python
Solution
If you need to just delete adjacent occurrences try this:
reduce(lambda x,y: x+[y] if x==[] or x[-1] != y else x, your_list,[])
If you need to delete all but one ocurrence try this:
reduce(lambda x,y: x+[y] if not y in x else x, your_list,[])
Problem
Is there a way in Python of making a List unique through functional paradigm ? Input : `[1,2,2,3,3,3,4]` Output: `[1,2,3,4]` (In order preserving manner) I know there are other ways but none is in the functional way.