Files
Exercitium/src/Julia/001.jl

10 lines
236 B
Julia

function same_to_next(lst)
return [x for (x, y) in zip(lst[1:end-1], lst[2:end]) if x == y]
end
check = [1, 2, 2, 2, 3, 3, 4]
println(same_to_next(check)) # [2, 2, 3]
check = collect(1:10)
println(same_to_next(check)) # Int64[]