I think I saw something about a mutate in place package. Specifically, I'm
looking for a package to automatically create safe versions of functions
like push! I've got a tiny macro if it doesn't exist elsewhere.
macro safe(f)
esc(safe(f))
end
function safe(f::Symbol)
f_string = string(f)
if f_string[length(f_string)] != '!'
error("Function must end in !")
end
f_chop = symbol(chop(f_string))
:(function $f_chop(x, args...)
x = copy(x)
$f(x, args...)
end)
end
@safe unshift!
Test.@test unshift([1, 2, 3], 1) == [1, 1, 2, 3]