Hi I'm currently trying to review some material in my course and I'm having a hard time coming up with a function that we will call 'unique' that produces a list of only unique numbers from a set of lists.
So for python I was thinking of using OOP and using an iterator.
>>> You have a list (1, 3, 3, 3, 5)
Return the list (1, 3, 5)
This is what I was thinking I'm not sure though.
Class Unique:
def __init__(self, s):
self.s = iter(s)
def __iter__(self):
return self
def __next__(self):
I'm not sure what do for the next function of this though. I'm also curious to see how to create a function that does the same method as above but in scheme. Thanks in advance for any comments or help.