(deep-clone arg)
  arg: any type
  returns any type

Returns a deep, recursive copy of its argument.

If arg is an array, string or table, this function allocates a new, mutable collection; recursively deep-clones each element from the original collection, storing the result into the new collection; and then returns that new collection.

If arg is an iterator, (deep-clone arg) is equivalent to (clone arg).

If arg is an object or RData with an op-deep-clone method, this function invokes that method and returns the result. When that method is not present, (deep-clone arg) is equivalent to (clone arg).

For other primitive types, the function simply returns arg.