2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -3,8 +3,12 @@
{{omit from|TI-83 BASIC}}
{{omit from|TI-89 BASIC}}
;Task:
Using two Arrays of equal length, create a Hash object
where the elements from one array (the keys) are linked
to the elements of the other (the values)
Related task: [[Associative arrays/Creation]]
;Related task:
*   [[Associative arrays/Creation]]
<br><br>

View file

@ -0,0 +1,6 @@
function arrToObj(keys, vals) {
return keys.reduce(function(map, key, index) {
map[key] = vals[index];
return map;
}, {});
}

View file

@ -0,0 +1 @@
hash(key, value)=Map(matrix(#key,2,x,y,if(y==1,key[x],value[x])));

View file

@ -1,3 +1,4 @@
my @keys = <a b c d e>;
my @vals = ^5;
my %hash = flat @keys Z @vals;
my @values = ^5;
my %hash = @keys Z=> @values;

View file

@ -1,2 +1,2 @@
my @v = <a b c d e>;
my %hash = @v Z=> @v.keys;
my %hash;
%hash{@keys} = @values;

View file

@ -1,2 +1 @@
my %hash;
%hash{@keys} = @vals;
%( @keys Z=> @values )

View file

@ -1 +1 @@
%( <a b c d e> Z=> ^5 )
{ @keys »=>« @values } # Will fail if the lists differ in length

View file

@ -4,7 +4,7 @@ values='triangle quadrilateral pentagon hexagon heptagon octagon nonagon decagon
keys ='thuhree vour phive sicks zeaven ate nein den duzun'
/* [↑] superfluous blanks added to humorous */
/* keys just because it looks prettier. */
call hash values,keys /*nothing, then let's leave Dodge*/ /*hash the keys to the values. */
call hash values,keys /*hash the keys to the values. */
parse arg query . /*get what was specified on C.L. */
if query=='' then exit /*Nothing? Then leave Dodge City*/
pad=left('',30) /*used for padding the display. */