Updates encode/decode to act like Array::map taking args val, idx, arr
Renames encode/decode to transform/restore