Hmm, this should work, though I don’t think it’s the most efficient way (it would be better to avoid creating the temporary arrays):
reduce(vcat, [first(x), last(x)] for x in ranges)
Hmm, this should work, though I don’t think it’s the most efficient way (it would be better to avoid creating the temporary arrays):
reduce(vcat, [first(x), last(x)] for x in ranges)