Difference between revisions of "Array.bykey()"

From ZCubes Wiki
Jump to navigation Jump to search
Line 35: Line 35:
 
a=a.concat([[8,3,4,5]]);
 
a=a.concat([[8,3,4,5]]);
 
a.bykey(1);
 
a.bykey(1);
{
+
 
  "3": [
+
{"3": [
 
[
 
[
 
13,
 
13,

Revision as of 03:45, 15 April 2020

bykey

Create an object with elements of array bucketed with the key specified.

Example

a=#TABLE1;

a.bykey(0)

{ "Amino Acid": [ [ "Amino Acid", "Symbol", "SLC", "DNA codons" ] ], "Isoleucine ": [ [ "Isoleucine ", "Ile", "I", "ATT, ATC, ATA" ] ],

etc a=MS(4); a=a.concat(8,3,4,5); a.bykey(1);

{"3": [ [ 13, 3, 2, 16 ], [ 8, 3, 4, 5 ] ], "6": [ [ 12, 6, 7, 9 ] ], "10": [ [ 8, 10, 11, 5 ] ], "15": [ [ 1, 15, 14, 4 ] ] }

See Also