smaz-tools: new primitive for in-place element replacement