Jmol.___JmolVersion="14.3.16_2015.09.21b" new feature: x = @a -- deep copy for a = array or associative array -- @a for string variable still gets the value of the variable named by variable a -- math environment only, not SELECT
On Mon, Sep 21, 2015 at 8:46 PM, Robert Hanson <hans...@stolaf.edu> wrote: > I think this is the essence of a deep copy: > > function deepCopy(a) { > switch (a.type) { > case "hash": > var b = {}; > for (var i = a.keys.length; i > 0; --i) { > var key = a.keys[i]; > b[key] = deepCopy(a[key]); > } > return b; > case "array": > var b = []; > for (var j = a.length; j > 0; --j) { > b[j] = deepCopy(a[j]); > } > return b; > default: > return a; > } > } > > -- Robert M. Hanson Larson-Anderson Professor of Chemistry Chair, Department of Chemistry St. Olaf College Northfield, MN http://www.stolaf.edu/people/hansonr If nature does not answer first what we want, it is better to take what answer we get. -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
------------------------------------------------------------------------------
_______________________________________________ Jmol-users mailing list Jmol-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-users