Hello, I was learning gleam and I was in the process of creating an exercise in it.
The exercise is known as Flatten Array. Basically in this question, I will have to take something like this
x = [1, 2, [3, 4, 5, 6], 7]
and the result should be:
x = [1, 2, 3, 4, 5, 6, 7]
Now, in order to solve this, I looked up the (gleam docs)[gleam/list - gleam_stdlib] for flatten method, and it takes an object of type List(List(a))
.
So it assumes that the list will be of the format
x = [[1], [2], [3, 4, 5, 6], [7]]
As you can see that subsequent type is a List(List(int))
.
But if you look into x
, the type is different.
How, can I represent this type in gleam?
Any help will be greatly appreciated!