[Scilab-Dev] XMLDoc==XMLDoc definition
Samuel Gougeon
sgougeon at free.fr
Sat Jul 28 18:57:27 CEST 2018
Le 28/07/2018 à 18:54, Samuel Gougeon a écrit :
> Hello Antoine,
>
> Thanks for your quick answer:
>
> Le 28/07/2018 à 18:28, Antoine ELIAS a écrit :
>> Hello Samuel,
>>
>> Example outside of xml "object" (lot of overloads)
>> a = mlist(["toto", "id"], 1);
>> b = mlist(["toto", "id"], 1);
>> a == b -> [%t %t]
>>
>> For mlist we compare the type ("toto") and fields ("id" in this case)
>
> and
> --> a = mlist(["aBcD", "id" "id2"], 1, 2);
> --> a==a
> ans =
> T T T
>
> OK: so
> a) there is actually a default equality definition
> b) it is actually type+fields-wise
> c) it looks not documented: none of the list, mlist, tlist,
> overloading, comparison, and equal pages indicate it.
> d) it is overloadable:
> function r= %aBcD_o_aBcD(a, b)
> r = typeof(a)==typeof(b);
> af = fieldnames(a);
> r = r & and(af==fieldnames(b));
> for f = af'
> r = r & and(a(f)==b(f))
> end
> endfunction
> --> a==a
> ans =
> T
For a overall lists comparison, we may also use directly
--> isequal(a,a)
ans =
T
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/dev/attachments/20180728/7e52ec28/attachment.htm>
More information about the dev
mailing list