<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">I guess existential types are like typed variables in languages such as Perl 6/Raku.<br>For instance,<br><div><br></div><div><pre class="language-text" style="-webkit-text-size-adjust: auto; color: rgb(59, 59, 59); background-color: rgb(249, 249, 249); white-space: pre; word-break: normal; word-wrap: normal; font-family: "Fira Code", Monaco, "Andale Mono", "Ubuntu Mono", monospace; tab-size: 4; -webkit-hyphens: none; font-size: medium; padding: 1em; margin-top: 0.5em; margin-bottom: 0.5em; overflow: auto; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; line-height: 1.5 !important;"><code class="language-text" style="background-image: none; word-spacing: normal; word-break: normal; word-wrap: normal; font-family: "Fira Code", Monaco, "Andale Mono", "Ubuntu Mono", monospace; tab-size: 4; -webkit-hyphens: none; line-height: 1.5 !important; font-size: 16px !important;">my Str $person = "Heya";</code></pre><div dir="ltr"><br></div><div id="AppleMailSignature" dir="ltr">Using them is a matter of taste, to quote Zoltan.</div><div id="AppleMailSignature" dir="ltr">I have yet to find a use for them.</div><div dir="ltr">Philippe</div><div dir="ltr"><br><blockquote type="cite">Le 19 mai 2021 à 00:27, Fabrice Nicol <fabrnicol@gmail.com> a écrit :<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><div dir="auto">Yes, this is one aspect that comes out clearly from the manual contrastive pair reprinted below:<div dir="auto"><br><div dir="auto"><font face="monospace"><span style="white-space:pre-wrap">:- some [T] pred e_bar1(T).
e_bar1(42).
e_bar1(42).
e_bar1(43).
        % ok (T = int)

:- some [T] pred bad_e_bar2(T).
bad_e_bar2(42).
bad_e_bar2("blah").
        % type error (cannot unify </span></font><br><font face="monospace"><span style="white-space:pre-wrap">types </span></font><span style="font-family:sans-serif;background-color:rgb(255,255,255)">`int' and `string')</span><br></div><div dir="auto"><span style="font-family:sans-serif;background-color:rgb(255,255,255)"><br></span></div><div dir="auto">This is for procedures: you kind of lock them into one type.</div><div dir="auto">When you consider existentially quantified type constructors, understandably (yet somewhat confusingly when you are first confronted to this) the perceived semantics is the opposite: you abstract away from type instantiation into a more general kind of representation. It is quite illuminating to look at how the 'univ' type is implemented in library/univ.m. </div><div dir="auto">More generally, type 'containers' can be concretely created this way to encapsulate items with possible alternative types, a bit like C unions. </div><div dir="auto"><br></div><div dir="auto">And yet the underlying operational logic is the same. Simply, it does not take place at the same level. </div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mar. 18 mai 2021 à 11:02 PM, Philippe de Rochambeau <<a href="mailto:phiroc@free.fr" rel="noreferrer noreferrer" target="_blank">phiroc@free.fr</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div dir="ltr">Fabrice,</div><div dir="ltr">Thank you for your input.</div><div dir="ltr"><div>I looked at the examples, but couldn’t figure out what practical use existential types might have. Perhaps a way of typing otherwise typeless parameters?</div><div>I guess time and practice will tell.</div><div>Cheers,</div><div><div dir="ltr">Philippe</div><div dir="ltr"><br><blockquote type="cite">Le 18 mai 2021 à 21:07, fabrice nicol <<a href="mailto:fabrnicol@gmail.com" rel="noreferrer noreferrer noreferrer" target="_blank">fabrnicol@gmail.com</a>> a écrit :<br><br></blockquote></div><blockquote type="cite"><div dir="ltr">
  

    
  
  
    Philippe,
    <div>
      <p>you have a set of straightforward examples pages 88-90 of the
        ROTD reference manual.</p>
      <p>Also, just above:</p>
      <blockquote>
        <p> "For procedures involving calls to existentially-typed
          predicates or functions, the compiler’s mode analysis must
          take account of the modes for type variables in all
          polymorphic calls. Universally quantified type variables have
          mode in, whereas existentially quantified type variables have
          mode out. "</p>
      </blockquote>
      <p>which outlines the relationship between some [T]... and the
        mode system. <br>
      </p>
      <p>(I found this relationship not entirely self-evident when I
        started out, but it became clearer with some practice).</p>
      <p>Fabrice<br>
      </p>
      <div>Le 18/05/2021 à 04:00, <a href="mailto:users-request@lists.mercurylang.org" rel="noreferrer noreferrer noreferrer" target="_blank">users-request@lists.mercurylang.org</a>
        a écrit :<br>
      </div>
      <blockquote type="cite">
        <pre>Send users mailing list submissions to
        <a href="mailto:users@lists.mercurylang.org" rel="noreferrer noreferrer noreferrer" target="_blank">users@lists.mercurylang.org</a>

To subscribe or unsubscribe via the World Wide Web, visit
        <a href="https://lists.mercurylang.org/listinfo/users" rel="noreferrer noreferrer noreferrer" target="_blank">https://lists.mercurylang.org/listinfo/users</a>
or, via email, send a message with subject or body 'help' to
        <a href="mailto:users-request@lists.mercurylang.org" rel="noreferrer noreferrer noreferrer" target="_blank">users-request@lists.mercurylang.org</a>

You can reach the person managing the list at
        <a href="mailto:users-owner@lists.mercurylang.org" rel="noreferrer noreferrer noreferrer" target="_blank">users-owner@lists.mercurylang.org</a>

When replying, please edit your Subject line so it is more specific
than "Re: Contents of users digest..."


Today's Topics:

   1. Using existential types (Philippe de Rochambeau)
   2. Re: Using existential types (Zoltan Somogyi)
   3. Re: Transposing array2d (fabrice nicol)
   4. Re: Transposing array2d (Sean Charles (emacstheviking))


----------------------------------------------------------------------

Message: 1
Date: Mon, 17 May 2021 12:12:39 +0200
From: Philippe de Rochambeau <a href="mailto:phiroc@free.fr" rel="noreferrer noreferrer noreferrer" target="_blank"><phiroc@free.fr></a>
To: <a href="mailto:users@lists.mercurylang.org" rel="noreferrer noreferrer noreferrer" target="_blank">users@lists.mercurylang.org</a>
Subject: [m-users.] Using existential types
Message-ID: <a href="mailto:7f911cd8-9220-4d32-a9dd-ee177fb46190@email.android.com" rel="noreferrer noreferrer noreferrer" target="_blank"><7f911cd8-9220-4d32-a9dd-ee177fb46190@email.android.com></a>
Content-Type: text/plain; charset="utf-8"

An HTML attachment was scrubbed...
URL: <a href="http://lists.mercurylang.org/archives/users/attachments/20210517/993681be/attachment-0001.html" rel="noreferrer noreferrer noreferrer" target="_blank"><http://lists.mercurylang.org/archives/users/attachments/20210517/993681be/attachment-0001.html></a>

------------------------------

Message: 2
Date: Mon, 17 May 2021 20:19:47 +1000 (AEST)
From: "Zoltan Somogyi" <a href="mailto:zoltan.somogyi@runbox.com" rel="noreferrer noreferrer noreferrer" target="_blank"><zoltan.somogyi@runbox.com></a>
To: "Philippe de Rochambeau" <a href="mailto:phiroc@free.fr" rel="noreferrer noreferrer noreferrer" target="_blank"><phiroc@free.fr></a>, "users"
        <a href="mailto:users@lists.mercurylang.org" rel="noreferrer noreferrer noreferrer" target="_blank"><users@lists.mercurylang.org></a>
Subject: Re: [m-users.] Using existential types
Message-ID: <a href="mailto:E1liaLj-0004BW-Fp@rmmprod05.runbox" rel="noreferrer noreferrer noreferrer" target="_blank"><E1liaLj-0004BW-Fp@rmmprod05.runbox></a>
Content-Type: text/plain; charset="utf-8"


2021-05-17 20:12 GMT+10:00 "Philippe de Rochambeau" <a href="mailto:phiroc@free.fr" rel="noreferrer noreferrer noreferrer" target="_blank"><phiroc@free.fr></a>:
</pre>
        <blockquote type="cite">
          <pre>Hello,could someone please explain the advantages of using existential types
(some) in predicates as opposed to universal types?Many thanks.Best regards,
</pre>
        </blockquote>
        <pre>It is not question of "which is better"; they have totally different roles.
Universal types implement parametric polymorphism (the same operation
applies to all types the same way), while existential types can help implement
non-parametric polymorphism (an operation applies only to a specified set
of types, and may be implemented differently for different types).

People whose programming style is mostly based on functional and
logic programming tend to use parametric polymorphism almost exclusively,
because they tend to use algebraic data types instead of non-parametric
polymorphism. People whose programming style is mostly based on
object oriented programming tend to use non-parametric polymorphism,
because until recently, the popular OO languages did not support either
parametric polymorphism or algebraic data types :-(

Zoltan.

------------------------------

Message: 3
Date: Mon, 17 May 2021 17:54:06 +0200
From: fabrice nicol <a href="mailto:fabrnicol@gmail.com" rel="noreferrer noreferrer noreferrer" target="_blank"><fabrnicol@gmail.com></a>
To: "Sean Charles (emacstheviking)" <a href="mailto:objitsu@gmail.com" rel="noreferrer noreferrer noreferrer" target="_blank"><objitsu@gmail.com></a>
Cc: users <a href="mailto:users@lists.mercurylang.org" rel="noreferrer noreferrer noreferrer" target="_blank"><users@lists.mercurylang.org></a>
Subject: Re: [m-users.] Transposing array2d
Message-ID: <a href="mailto:2af3a9ed-1d70-8784-e49c-e8fac88b789a@gmail.com" rel="noreferrer noreferrer noreferrer" target="_blank"><2af3a9ed-1d70-8784-e49c-e8fac88b789a@gmail.com></a>
Content-Type: text/plain; charset="utf-8"; Format="flowed"

Thanks Sean, actually  the 'transpose' algorithm is encoded in file 
'Matrix.asm', not in in Array.asm as I first thought.

I will look into it and see if it proves useful.

Fabrice

Le 17/05/2021 à 10:01, Sean Charles (emacstheviking) a écrit :
</pre>
        <blockquote type="cite">
          <pre>On a possibly connected but probably orthogonal note, this came across 
my radar from the SWI list, an assembly language written numerical 
library. I don’t know if it has array transposition but somebody might 
care to wrap it with the FFI library in the future? It does have Array 
Functions section and moving and copying things but no explicit 
mention on that page. The source might reveal more.

<a href="http://linasm.sourceforge.net/docs/api/array.php" rel="noreferrer noreferrer noreferrer" target="_blank">http://linasm.sourceforge.net/docs/api/array.php</a> 
<a href="http://linasm.sourceforge.net/docs/api/array.php" rel="noreferrer noreferrer noreferrer" target="_blank"><http://linasm.sourceforge.net/docs/api/array.php></a>

<a href="http://linasm.sourceforge.net/about/benchmarks.php" rel="noreferrer noreferrer noreferrer" target="_blank">http://linasm.sourceforge.net/about/benchmarks.php</a> 
<a href="http://linasm.sourceforge.net/about/benchmarks.php" rel="noreferrer noreferrer noreferrer" target="_blank"><http://linasm.sourceforge.net/about/benchmarks.php></a>


</pre>
          <blockquote type="cite">
            <pre>On 17 May 2021, at 06:50, fabrice nicol <<a href="mailto:fabrnicol@gmail.com" rel="noreferrer noreferrer noreferrer" target="_blank">fabrnicol@gmail.com</a> 
<a href="mailto:fabrnicol@gmail.com" rel="noreferrer noreferrer noreferrer" target="_blank"><mailto:fabrnicol@gmail.com></a>> wrote:

I wondered whether someone ever implemented a 'transpose' procedure 
for array2d.

As there seems to be none, I have implemented a basic fallback here: 
<a href="https://github.com/fabnicol/RMercury/blob/library/ri.m" rel="noreferrer noreferrer noreferrer" target="_blank">https://github.com/fabnicol/RMercury/blob/library/ri.m</a>, line 1236.

[Note: the library itself is very much work in progress, with 
numerous issues and loose ends. I'm just quoting it for reference to 
'transpose'.]

This works, but it is the basic Cate & Twigg formula. There are 
numerous better options around, perhaps someone knows of some free 
code around?

Fabrice


_______________________________________________
users mailing list
<a href="mailto:users@lists.mercurylang.org" rel="noreferrer noreferrer noreferrer" target="_blank">users@lists.mercurylang.org</a> <a href="mailto:users@lists.mercurylang.org" rel="noreferrer noreferrer noreferrer" target="_blank"><mailto:users@lists.mercurylang.org></a>
<a href="https://lists.mercurylang.org/listinfo/users" rel="noreferrer noreferrer noreferrer" target="_blank">https://lists.mercurylang.org/listinfo/users</a>
</pre>
          </blockquote>
        </blockquote>
        <pre>-------------- next part --------------
An HTML attachment was scrubbed...
URL: <a href="http://lists.mercurylang.org/archives/users/attachments/20210517/43022076/attachment-0001.html" rel="noreferrer noreferrer noreferrer" target="_blank"><http://lists.mercurylang.org/archives/users/attachments/20210517/43022076/attachment-0001.html></a>

------------------------------

Message: 4
Date: Mon, 17 May 2021 16:54:39 +0100
From: "Sean Charles (emacstheviking)" <a href="mailto:objitsu@gmail.com" rel="noreferrer noreferrer noreferrer" target="_blank"><objitsu@gmail.com></a>
To: fabrice nicol <a href="mailto:fabrnicol@gmail.com" rel="noreferrer noreferrer noreferrer" target="_blank"><fabrnicol@gmail.com></a>
Cc: users <a href="mailto:users@lists.mercurylang.org" rel="noreferrer noreferrer noreferrer" target="_blank"><users@lists.mercurylang.org></a>
Subject: Re: [m-users.] Transposing array2d
Message-ID: <a href="mailto:0F3EA632-2AA8-4195-98EC-CED7D91B0D9E@gmail.com" rel="noreferrer noreferrer noreferrer" target="_blank"><0F3EA632-2AA8-4195-98EC-CED7D91B0D9E@gmail.com></a>
Content-Type: text/plain; charset="utf-8"

As usual, it’s the naming of things that’s the hardest! I hope it proves useful…
:)

</pre>
        <blockquote type="cite">
          <pre>On 17 May 2021, at 16:54, fabrice nicol <a href="mailto:fabrnicol@gmail.com" rel="noreferrer noreferrer noreferrer" target="_blank"><fabrnicol@gmail.com></a> wrote:

Thanks Sean, actually  the 'transpose' algorithm is encoded in file 'Matrix.asm', not in in Array.asm as I first thought. 

I will look into it and see if it proves useful.

Fabrice

Le 17/05/2021 à 10:01, Sean Charles (emacstheviking) a écrit :
</pre>
          <blockquote type="cite">
            <pre>On a possibly connected but probably orthogonal note, this came across my radar from the SWI list, an assembly language written numerical library. I don’t know if it has array transposition but somebody might care to wrap it with the FFI library in the future? It does have Array Functions section and moving and copying things but no explicit mention on that page. The source might reveal more.

<a href="http://linasm.sourceforge.net/docs/api/array.php" rel="noreferrer noreferrer noreferrer" target="_blank">http://linasm.sourceforge.net/docs/api/array.php</a> <a href="http://linasm.sourceforge.net/docs/api/array.php" rel="noreferrer noreferrer noreferrer" target="_blank"><http://linasm.sourceforge.net/docs/api/array.php></a>

<a href="http://linasm.sourceforge.net/about/benchmarks.php" rel="noreferrer noreferrer noreferrer" target="_blank">http://linasm.sourceforge.net/about/benchmarks.php</a> <a href="http://linasm.sourceforge.net/about/benchmarks.php" rel="noreferrer noreferrer noreferrer" target="_blank"><http://linasm.sourceforge.net/about/benchmarks.php></a>


</pre>
            <blockquote type="cite">
              <pre>On 17 May 2021, at 06:50, fabrice nicol <<a href="mailto:fabrnicol@gmail.com" rel="noreferrer noreferrer noreferrer" target="_blank">fabrnicol@gmail.com</a> <a href="mailto:fabrnicol@gmail.com" rel="noreferrer noreferrer noreferrer" target="_blank"><mailto:fabrnicol@gmail.com></a>> wrote:

I wondered whether someone ever implemented a 'transpose' procedure for array2d.

As there seems to be none, I have implemented a basic fallback here: <a href="https://github.com/fabnicol/RMercury/blob/library/ri.m" rel="noreferrer noreferrer noreferrer" target="_blank">https://github.com/fabnicol/RMercury/blob/library/ri.m</a> <a href="https://github.com/fabnicol/RMercury/blob/library/ri.m" rel="noreferrer noreferrer noreferrer" target="_blank"><https://github.com/fabnicol/RMercury/blob/library/ri.m></a>, line 1236. 

[Note: the library itself is very much work in progress, with numerous issues and loose ends. I'm just quoting it for reference to 'transpose'.]

This works, but it is the basic Cate & Twigg formula. There are numerous better options around, perhaps someone knows of some free code around?

Fabrice



_______________________________________________
users mailing list
<a href="mailto:users@lists.mercurylang.org" rel="noreferrer noreferrer noreferrer" target="_blank">users@lists.mercurylang.org</a> <a href="mailto:users@lists.mercurylang.org" rel="noreferrer noreferrer noreferrer" target="_blank"><mailto:users@lists.mercurylang.org></a>
<a href="https://lists.mercurylang.org/listinfo/users" rel="noreferrer noreferrer noreferrer" target="_blank">https://lists.mercurylang.org/listinfo/users</a> <a href="https://lists.mercurylang.org/listinfo/users" rel="noreferrer noreferrer noreferrer" target="_blank"><https://lists.mercurylang.org/listinfo/users></a>
</pre>
            </blockquote>
          </blockquote>
        </blockquote>
        <pre>-------------- next part --------------
An HTML attachment was scrubbed...
URL: <a href="http://lists.mercurylang.org/archives/users/attachments/20210517/ecfcdd58/attachment-0001.html" rel="noreferrer noreferrer noreferrer" target="_blank"><http://lists.mercurylang.org/archives/users/attachments/20210517/ecfcdd58/attachment-0001.html></a>

------------------------------

Subject: Digest Footer

_______________________________________________
users mailing list
<a href="mailto:users@lists.mercurylang.org" rel="noreferrer noreferrer noreferrer" target="_blank">users@lists.mercurylang.org</a>
<a href="https://lists.mercurylang.org/listinfo/users" rel="noreferrer noreferrer noreferrer" target="_blank">https://lists.mercurylang.org/listinfo/users</a>


------------------------------

End of users Digest, Vol 81, Issue 23
*************************************
</pre>
      </blockquote>
    </div>
  

<span>_______________________________________________</span><br><span>users mailing list</span><br><span><a href="mailto:users@lists.mercurylang.org" rel="noreferrer noreferrer noreferrer" target="_blank">users@lists.mercurylang.org</a></span><br><span><a href="https://lists.mercurylang.org/listinfo/users" rel="noreferrer noreferrer noreferrer" target="_blank">https://lists.mercurylang.org/listinfo/users</a></span><br></div></blockquote></div></div></div></blockquote></div>
</div></blockquote></div></body></html>