How can I remove nils from this list ,lets say i get:
[{"some","other",[]},nil,{{"more","somemore",[]},nil,nil}]
In the end I would like to extract only the first elements from the long tuples and put them on a list, Something like:
["some", "more"]
You can remove nils from the list using function like that:
This function does not remove nils within tuples though.
And you can use a couple of functions to extract every first non tuple element in you list (like strings "some" and more):
Function
extract_first_non_tuple_element
is recursive, because in your example tuple can be nested.So to test this functions:
Update. To remove nils from nested tuples we can use function like that: