Hi all,

I try to build a multi-level data structure in Jmol. The first level is 
an associative array (hash) and the second level is an array.

Example:
   x = {};
   x.a = ["test1"];

---- output of 'print x' --------
{
   a  :
   [
     test1
   ]
}
----------------------------------

Unfortunately I couldn't figure out how to extend the second-level 
array. I tried for example the following without success in version 
14.3.12_2015.03.01:

$ x.a.push("test2")
script ERROR: invalid argument
----
           x . a . push ( "test2" >> ) <<

$ x["a"].push("test2")
script ERROR: invalid argument
----
           x [ "a" ] . push ( "test2" >> ) <<

$ (x["a"]).push("test2")
script ERROR: invalid argument
----
           ( x [ "a" ] >> ) << . push ( "test2" )

$ (x["a"])[x["a"].size + 1] = "test2"
script ERROR: invalid argument
----
           ( x [ "a" ] >> ) << [ x [ "a" ] . size + 1 ] = "test2"

$ x{"a"}.push("test2")
script compiler ERROR: command expected
----
           >>>> x <<<<


Do you know any way to do this?

The hash key "a" would actually be contained in a variable, so the '.' 
and ".." notation would not really be suitable for my purpose, even if 
they would have worked. Replacing "a" by a variable name in the bracket 
or braces notation didn't make any difference.
(By the way, the braces notation mentioned in the documentation wasn't 
even accepted in a single level hash.)

Regards,
Rolf
-- 

Rolf Huehne
Postdoc

Leibniz Institute for Age Research - Fritz Lipmann Institute (FLI)
Beutenbergstrasse 11
07745 Jena, Germany

Phone:   +49 3641 65 6205
Fax:     +49 3641 65 6210
E-Mail:  rhue...@fli-leibniz.de
Website: http://www.fli-leibniz.de

           Scientific Director: Prof. Dr. K. Lenhard Rudolph
        Head of Administration: Dr. Daniele Barthel
Chairman of Board of Trustees: Dennys Klein

VAT No: DE 153 925 464
Register of Associations: No. 230296, Amtsgericht Jena
Tax Number: 162/141/08228


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to