cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
hogi
Level XII

Issue with associative arrays and default values

Why is it not possible to specify an associative array as default value?

 

create = Function( {x},	Associative Array( {{"value", x}} )	);

create(1);
Associative Array(Eval List({ Eval List( {1, create(1)})}));   // [1 => ["value" => x]]
Associative Array(Eval List({ Eval List( {1, create(1)})}),2); // [1 => ["value" => x], => 2]


Associative Array(Eval List({Eval List( {1, create(1)})}),		create( 2 )); // empty ?!?!?

//deep dive
Associative Array({ {1, 1}},create(2)); // doesn't work
Associative Array( {1}, {1},create(2)); // works

One could argue that providing the default value during the creation of the associative array is not possible - but it works in 2 out of 4 cases.

 

hogi_0-1727335823514.png

 

1 REPLY 1
hogi
Level XII

Re: Issue with associative arrays and default values

workaround: 

<< Set Default Value( )