АО
Size: a a a
АО
ЛЛ
ЛЛ
ЛЛ
АО
KT
abs.(arr[1 : end - 1] .- arr[2 : end]) .> threshold
KT
KT
KT
АО
KT
АО
for. Но думаю, что её можно дотюнитьfunction partition_for(arr::Vector{T}; threshold = 2.0) where T
res = Vector{Vector{T}}()
buf = T[]
for x in arr
if isempty(buf) || abs(x - buf[end]) < threshold
push!(buf, x)
elseif length(buf) > 1
push!(res, buf)
buf = T[]
else
buf = T[]
end
end
length(buf) > 1 && push!(res, buf)
res
endАО
reduce версииИЦ
ЛЛ
GI
KT