I agree completely. Good catch!
$ show @{ ([3,4,5])[1][1] }
[3]
is correct. array[i][j] should always return an array, provided i <= the
length of the array.
This behavior is suggested by the documentation, and that it would return
just the number 3 is
unexpected.
Fixed for Jmol 14.0/1.8
Bob
On Wed, Jan 22, 2014 at 5:20 AM, Alexander Rose <[email protected]
> wrote:
> Hi,
>
> - the hash type is missing in the description of the type method under the
> heading "general .xxx functions"
>
>
> I do not know if this is intentional. Range selecting from lists returns a
> list when there is more then one item in the list but only the item for
> single item lists (and not a single item list)
>
> var l = [0]; l=l[1][50]; show l;
> => l = 0
>
> var l = [0,1]; l=l[1][50]; show l;
> => l = [0,1]
>
> I had some code where I expected a list after range selecting from a list.
> Took me a while to find out what was the cause. For now I wrap it in a
> listify function (see below) but one gets into trouble with lists of lists.
>
>
>
> Best
> Alexander
>
>
>
> function listify( x ){
> if( x.type=="array" ){
> return x;
> }else{
> return [ x ];
> }
> }
>
>
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
> _______________________________________________
> Jmol-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>
--
Robert M. Hanson
Larson-Anderson Professor 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
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users