cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Choose Language Hide Translation Bar
View Original Published Thread

Issue with associative arrays and default values

hogi
Level XII

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( )