Code: Select all
{
:local a (1,2,3);
:local b [:toarray $a];
:put "a is $[:typeof $a] len $[:len $a]:";
:put $a;
:put "b is $[:typeof $b] len $[:len $b]:";
:put $b;
:put "equiv...";
:if ($a=$b) do={:put "yes"} else={:put "no"}
}
Code: Select all
a is array len 3:
1;2;3
b is array len 3:
1;2;3
equiv...
yes
Code: Select all
:local a {"a"="A";"b"="B";"c"="C"};
Code: Select all
a is array len 3:
a=A;b=B;c=C
b is array len 0:
equiv...
no
(Please don't ask the naive question "Why would you ever need to cast an array to an array if it's already an array?" Asking that likely means you've not tried writing robust scripts that expect an array as input but can gracefully handle non-array data too in certain cases. If casting had worked as expected, then it would permit handling input data in several forms without having to add code to test input data types.)
Is this a bug?
Wondering...
Aaron out.