<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Le 28/07/2018 à 18:54, Samuel Gougeon a
      écrit :<br>
    </div>
    <blockquote cite="mid:8b6a0d3c-c59f-c5f4-6410-ccb5427f82a4@free.fr"
      type="cite">
      <meta content="text/html; charset=windows-1252"
        http-equiv="Content-Type">
      <div class="moz-cite-prefix">Hello Antoine,<br>
        <br>
        Thanks for your quick answer:<br>
        <br>
        Le 28/07/2018 à 18:28, Antoine ELIAS a écrit :<br>
      </div>
      <blockquote
        cite="mid:11d2b515-27ed-e35f-231a-54ee2da0e4f0@scilab-enterprises.com"
        type="cite">
        <meta http-equiv="Content-Type" content="text/html;
          charset=windows-1252">
        Hello Samuel,<br>
        <br>
        Example outside of xml "object" (lot of overloads)<br>
        <tt>a = mlist(["toto", "id"], 1);</tt><tt><br>
        </tt><tt>b = mlist(["toto", "id"], 1);</tt><tt><br>
        </tt><tt>a == b -> [%t %t]</tt><tt><br>
        </tt><br>
        For mlist we compare the type ("toto") and fields  ("id" in this
        case)<br>
      </blockquote>
      <br>
      and<br>
      <tt>--> a = mlist(["aBcD", "id" "id2"], 1, 2);</tt><tt><br>
      </tt><tt>--> a==a</tt><tt><br>
      </tt><tt> ans  =</tt><tt><br>
      </tt><tt>  T T T</tt><br>
      <br>
      OK: so<br>
      a) there is actually a default equality definition<br>
      b) it is actually type+fields-wise<br>
      c) it looks not documented: none of the list, mlist, tlist,
      overloading, comparison, and equal pages indicate it.<br>
      d) it is overloadable:<br>
      <pre style="font-family:Monospaced;font-style:normal;font-size:12.0;"><span style="color:rgb(176,24,19);">function</span> <span style="color:rgb(131,67,16);font-weight:bold;">r</span><span style="color:rgb(92,92,92);"> = </span><span style="color:rgb(0,0,0);text-decoration:underline;">%aBcD_o_aBcD</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(131,67,16);font-weight:bold;">a</span><span style="color:rgb(0,0,0);">, </span><span style="color:rgb(131,67,16);font-weight:bold;">b</span><span style="color:rgb(74,85,219);">)</span>
    <span style="color:rgb(131,67,16);font-weight:bold;">r</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(50,185,185);">typeof</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(131,67,16);font-weight:bold;">a</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">==</span><span style="color:rgb(50,185,185);">typeof</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(131,67,16);font-weight:bold;">b</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
    <span style="color:rgb(0,0,0);">af</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(50,185,185);">fieldnames</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(131,67,16);font-weight:bold;">a</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
    <span style="color:rgb(131,67,16);font-weight:bold;">r</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(131,67,16);font-weight:bold;">r</span> <span style="color:rgb(92,92,92);">&</span> <span style="color:rgb(50,185,185);">and</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">af</span><span style="color:rgb(92,92,92);">==</span><span style="color:rgb(50,185,185);">fieldnames</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(131,67,16);font-weight:bold;">b</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
    <span style="color:rgb(160,32,240);">for</span> <span style="color:rgb(174,92,176);text-decoration:underline;">f</span> <span style="color:rgb(188,143,143);">=</span> <span style="color:rgb(188,143,143);">af'</span>
        <span style="color:rgb(131,67,16);font-weight:bold;">r</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(131,67,16);font-weight:bold;">r</span> <span style="color:rgb(92,92,92);">&</span> <span style="color:rgb(50,185,185);">and</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(131,67,16);font-weight:bold;">a</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(174,92,176);text-decoration:underline;">f</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(92,92,92);">==</span><span style="color:rgb(131,67,16);font-weight:bold;">b</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(174,92,176);text-decoration:underline;">f</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">)</span>
    <span style="color:rgb(160,32,240);">end</span>
<span style="color:rgb(176,24,19);">endfunction</span></pre>
      <tt>--> a==a</tt><tt><br>
      </tt><tt> ans  =</tt><tt><br>
      </tt><tt>  T</tt><tt><br>
      </tt></blockquote>
    <br>
    For a overall lists comparison, we may also use directly<br>
    <tt>--> isequal(a,a)</tt><tt><br>
    </tt><tt> ans  =</tt><tt><br>
    </tt><tt>  T</tt><br>
    <tt><br>
    </tt>
  </body>
</html>