Is there a reason why
julia> str = " a"
" a"
julia> filter(isspace, str)
" "
works but
julia> filter!(isspace, str)
ERROR: MethodError: no method matching filter!(::typeof(isspace), ::String)
Closest candidates are:
filter!(::Any, ::AbstractArray{T,1} where T) at array.jl:2503
filter!(::Any, ::IdDict) at iddict.jl:162
filter!(::Any, ::Dict{K,V}) where {K, V} at dict.jl:686
...
Stacktrace:
[1] top-level scope at REPL[3]:1
doesn’t? Why there isn’t a mutating form of filter
for strings?
5 posts - 3 participants