In this exercise you have the freedom to chose the type of sequence you want to work with (arrays, lists, vectors, ...) according to the language you're using.
Let's define a "nested sequence" as a sequence where each element can be either:
Let's define a "nested sequence" as a sequence where each element can be either:
- a value.
- a nested sequence
Notesa = (5, (3, 2), ((5, (3, 2), 4), (2, 1)), 2)
f(a) -> (5, 3, 2, 5, 3, 2, 4, 2, 1, 2)
- You should be able to deal with deep nestings. Consider that there is no depth limit.
- If your language implements this function, clearly don't use it
- Bonus points: Don't use a for loop.