Re: Postiats and C errors with array

2018-08-07 Thread 'Yannick Duchêne' via ats-lang-users


Le mardi 7 août 2018 21:40:16 UTC+2, gmhwxi a écrit :
>
> >>Python surprisingly does not have direct support for arrays,
>
> Python is not famous for being effcient :)
>

I know, at least 40x worse than the equivalent in any imperative language. 
I’m using it rather for its terse syntax (and because it’s everywhere), but 
I badly miss typing with it (PyLint helps a bit to workaround this, but 
just a bit).

Talking about it, the first thing I will do when the documentation I 
attempt to write will be finished, is to try to port my Postiats utilities 
to ATS2 and see how much I can have something as terse as the Python 
version. I believe it will be a good real world exercice (for know, I just 
tested ATS2 with propositions based proving three years ago, and I gave up, 
because I wanted too much from it).

-- 
You received this message because you are subscribed to the Google Groups 
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ats-lang-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/a34d4710-84b5-42ab-971e-f4d6f4953952%40googlegroups.com.


Re: Postiats and C errors with array

2018-08-07 Thread Hongwei Xi
>>Python surprisingly does not have direct support for arrays,

Python is not famous for being effcient :)



On Tue, Aug 7, 2018 at 3:20 PM, 'Yannick Duchêne' via ats-lang-users <
ats-lang-users@googlegroups.com> wrote:

>
>
> Le mardi 7 août 2018 19:39:54 UTC+2, gmhwxi a écrit :
>>
>>
>> >>multiple dimension array types is not supported,
>>
>> We will support mutiple dimension arrays in ATS3. Such arrays
>> are a necessity for many machine learning algorithms.
>>
>
> Yes, in some applications, arrays are as muche ubiquitous as dictionaries
> are in some other applications. By he way, unless I missed it, Python
> surprisingly does not have direct support for arrays, it only has lists.
>
>
>
> Le mardi 7 août 2018 19:36:06 UTC+2, gmhwxi a écrit :
>>
>>
>> >>I wonder why `#include "share/atspre_staload.hats"` of the basics which
>> are always loaded by default, because "share/atspre_staload.hats"  seems
>> often required.
>>
>> If you use ATS to generate, say, JavaScript, then you need a different
>> header.
>>
>
> (shy) yes. May be an idea for ATS3, could be selection of includes based
> on the target language. Ex. there could be directories named after the
> target containing includes whose content depends on that language. The
> include statement would be target neutral, but the file actually included
> would depend on the target language.
>
> --
> You received this message because you are subscribed to the Google Groups
> "ats-lang-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ats-lang-users+unsubscr...@googlegroups.com.
> To post to this group, send email to ats-lang-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/ats-lang-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ats-lang-users/d5db42e5-385e-4f34-bae2-b2c49ba17756%
> 40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ats-lang-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLoCMoDPQKCEXi6MEG-g5W5H1prRHtNRBME%2B8vBcg62oLQ%40mail.gmail.com.


Re: Postiats and C errors with array

2018-08-07 Thread Hongwei Xi
>>multiple dimension array types is not supported,

We will support mutiple dimension arrays in ATS3. Such arrays
are a necessity for many machine learning algorithms.

On Tue, Aug 7, 2018 at 1:36 PM, Hongwei Xi  wrote:

>
> >>I wonder why `#include "share/atspre_staload.hats"` of the basics which
> are always loaded by default, because "share/atspre_staload.hats" seems
> often required.
>
> If you use ATS to generate, say, JavaScript, then you need a different
> header.
>
> On Tue, Aug 7, 2018 at 4:00 AM, 'Yannick Duchêne' via ats-lang-users <
> ats-lang-users@googlegroups.com> wrote:
>
>>
>>
>> Le mardi 7 août 2018 03:37:55 UTC+2, Julian Fondren a écrit :
>>>
>>> Incidentally, this works:
>>>
>>> #include "share/atspre_staload.hats"
>>>
>>> typedef row = @(int, int, int)
>>> val row1: row = (1, 2, 3)
>>> val row2: row = (4, 5, 6)
>>> var a = @[row](row1, row2)
>>> val a12 = a[1].2
>>>
>>> implement main0() = println!(a12)
>>>
>>>
>>>
>> So with tuples. Indeed, I know it works, but I was trying some samples to
>> document expressions of the form `[…] ` and wanted to try second level
>> indexing of arrays.
>>
>> By the way, I wonder why `#include "share/atspre_staload.hats"` of the
>> basics which are always loaded by default, because
>> "share/atspre_staload.hats" seems often required.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "ats-lang-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to ats-lang-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to ats-lang-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/ats-lang-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/ats-lang-users/e3fb18b9-b344-4be2-8b53-10dc1ea2edf0%40go
>> oglegroups.com
>> 
>> .
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ats-lang-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLpwnJdNhAPCOsHfRa1gioAZvPXnCgEBhne7UO2_oqtDjw%40mail.gmail.com.


Re: Postiats and C errors with array

2018-08-07 Thread Hongwei Xi
>>I wonder why `#include "share/atspre_staload.hats"` of the basics which
are always loaded by default, because "share/atspre_staload.hats" seems
often required.

If you use ATS to generate, say, JavaScript, then you need a different
header.

On Tue, Aug 7, 2018 at 4:00 AM, 'Yannick Duchêne' via ats-lang-users <
ats-lang-users@googlegroups.com> wrote:

>
>
> Le mardi 7 août 2018 03:37:55 UTC+2, Julian Fondren a écrit :
>>
>> Incidentally, this works:
>>
>> #include "share/atspre_staload.hats"
>>
>> typedef row = @(int, int, int)
>> val row1: row = (1, 2, 3)
>> val row2: row = (4, 5, 6)
>> var a = @[row](row1, row2)
>> val a12 = a[1].2
>>
>> implement main0() = println!(a12)
>>
>>
>>
> So with tuples. Indeed, I know it works, but I was trying some samples to
> document expressions of the form `[…] ` and wanted to try second level
> indexing of arrays.
>
> By the way, I wonder why `#include "share/atspre_staload.hats"` of the
> basics which are always loaded by default, because
> "share/atspre_staload.hats" seems often required.
>
> --
> You received this message because you are subscribed to the Google Groups
> "ats-lang-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ats-lang-users+unsubscr...@googlegroups.com.
> To post to this group, send email to ats-lang-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/ats-lang-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ats-lang-users/e3fb18b9-b344-4be2-8b53-10dc1ea2edf0%
> 40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ats-lang-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLo_rPo1pGPyLG_72yb%2BRM9YmHed0%3DxFp1atoP9h2kFekA%40mail.gmail.com.


Re: Postiats and C errors with array

2018-08-07 Thread 'Yannick Duchêne' via ats-lang-users


Le mardi 7 août 2018 10:04:58 UTC+2, Yannick Duchêne a écrit :
>
> […] It was not my matter, but may be for arrays with multiple dimension, 
> using abstract types and external implementation may be an option, but I 
> have never tried it.
>

Or rather interpret one-dimension array as the storage of a 
multi‑dimensions array. 

-- 
You received this message because you are subscribed to the Google Groups 
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ats-lang-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/4939d5e6-d15c-433e-9d40-98b6cf917c45%40googlegroups.com.


Re: Postiats and C errors with array

2018-08-07 Thread 'Yannick Duchêne' via ats-lang-users


Le mardi 7 août 2018 10:00:51 UTC+2, Yannick Duchêne a écrit :
>
> […]
> By the way, I wonder why `#include "share/atspre_staload.hats"` of the 
> basics which are always loaded by default, because 
> "share/atspre_staload.hats" seems often required.
>

Typo, sorry. I wanted to say  “I wonder why `#include 
"share/atspre_staload.hats"` **is not part** of the basics”.

-- 
You received this message because you are subscribed to the Google Groups 
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ats-lang-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/dbbc1438-2cc8-4bde-b54a-ab806ff51e1b%40googlegroups.com.


Re: Postiats and C errors with array

2018-08-07 Thread 'Yannick Duchêne' via ats-lang-users


Le mardi 7 août 2018 04:18:01 UTC+2, gmhwxi a écrit :
>
>
> @[int][3] is the type for a flat int array of size 3.
>
> Unfortunately, it is not fully supported at this point
> (it can only be assigned to a var). Please use @(int, int, int)
> instead.
>

Indeed, this works if there are only top‑level vars:

#include "share/atspre_staload.hats"
typedef row = @[int][3]
var row:row = @[int](1, 2, 3)
val r2 = row[2]

I just though although multiple dimension array types is not supported, it 
could be supported indirectly the way I tried it. It was not my matter, but 
may be for arrays with multiple dimension, using abstract types and 
external implementation may be an option, but I have never tried it.

-- 
You received this message because you are subscribed to the Google Groups 
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ats-lang-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/a35ec12f-c8f0-4871-9ac6-b588c1873885%40googlegroups.com.


Re: Postiats and C errors with array

2018-08-07 Thread 'Yannick Duchêne' via ats-lang-users


Le mardi 7 août 2018 03:37:55 UTC+2, Julian Fondren a écrit :
>
> Incidentally, this works:
>
> #include "share/atspre_staload.hats"
>
> typedef row = @(int, int, int)
> val row1: row = (1, 2, 3)
> val row2: row = (4, 5, 6)
> var a = @[row](row1, row2)
> val a12 = a[1].2
>
> implement main0() = println!(a12)
>
>
>
So with tuples. Indeed, I know it works, but I was trying some samples to 
document expressions of the form `[…] ` and wanted to try second level 
indexing of arrays.

By the way, I wonder why `#include "share/atspre_staload.hats"` of the 
basics which are always loaded by default, because 
"share/atspre_staload.hats" seems often required.

-- 
You received this message because you are subscribed to the Google Groups 
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ats-lang-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/e3fb18b9-b344-4be2-8b53-10dc1ea2edf0%40googlegroups.com.


Re: Postiats and C errors with array

2018-08-06 Thread Artyom Shalkhakov
вт, 7 авг. 2018 г. в 8:18, Hongwei Xi :

>
> @[int][3] is the type for a flat int array of size 3.
>
> Unfortunately, it is not fully supported at this point
> (it can only be assigned to a var). Please use @(int, int, int)
> instead.
>
>
Are you planning to support this in ATS3?

I guess another way to solve this problem right now is to use $extype for
[row].


> On Mon, Aug 6, 2018 at 7:51 PM, 'Yannick Duchêne' via ats-lang-users <
> ats-lang-users@googlegroups.com> wrote:
>
>> I’m unsure if it’s something wrong with what I wrote (ex. may be it’s not
>> allowed) or with Postiats. The sample below type‑checks, but compilation
>> fails with an INTERROR message.
>>
>> The sample:
>>
>> typedef row = @[int][3]
>> val row1:row = @[int](1, 2, 3)
>> val row2:row = @[int](4, 5, 6)
>> var a = @[row][2](row1, row2)
>> val a12 = a[1].[2]
>>
>> On the second line, it fails with:
>>
>> > INTERROR(pats_ccomp_dynexp): hidexp_ccomp: hde0 =
>> HDEarrinit(HSEapp(HSEcst(atstkind_t0ype);
>> HSEs2exp(S2Eextkind(atstype_int))); HDEint(3); HDEi0nt(1); HDEi0nt(2);
>> HDEi0nt(3))
>>
>>
>> If I try this instead:
>>
>> typedef row = @[int][3]
>> var row1:row = @[int](1, 2, 3)
>> var row2:row = @[int](4, 5, 6)
>> var a = @[row][2](row1, row2)
>> val a12 = a[1].[2]
>>
>> … Postiats can compile it, but I then I have numerous error while
>> compiling C. Many of these errors mentions ATSstatmpdec and there are also
>> C syntax errors.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "ats-lang-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to ats-lang-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to ats-lang-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/ats-lang-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ats-lang-users/9695cba1-b5c0-463e-9356-60035b1bb142%40googlegroups.com
>> 
>> .
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "ats-lang-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ats-lang-users+unsubscr...@googlegroups.com.
> To post to this group, send email to ats-lang-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/ats-lang-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLpehPjppMhcBfqevkwuKAynk8oEjs9ytaxa0Y6_CPXSww%40mail.gmail.com
> 
> .
>


-- 
Cheers,
Artyom Shalkhakov

-- 
You received this message because you are subscribed to the Google Groups 
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ats-lang-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/CAKO6%3Dqj-jNhH7UmEeLRU0sfwLtnuhQzgfKrJLdKKKMUj2CZVCQ%40mail.gmail.com.


Re: Postiats and C errors with array

2018-08-06 Thread Hongwei Xi
@[int][3] is the type for a flat int array of size 3.

Unfortunately, it is not fully supported at this point
(it can only be assigned to a var). Please use @(int, int, int)
instead.

On Mon, Aug 6, 2018 at 7:51 PM, 'Yannick Duchêne' via ats-lang-users <
ats-lang-users@googlegroups.com> wrote:

> I’m unsure if it’s something wrong with what I wrote (ex. may be it’s not
> allowed) or with Postiats. The sample below type‑checks, but compilation
> fails with an INTERROR message.
>
> The sample:
>
> typedef row = @[int][3]
> val row1:row = @[int](1, 2, 3)
> val row2:row = @[int](4, 5, 6)
> var a = @[row][2](row1, row2)
> val a12 = a[1].[2]
>
> On the second line, it fails with:
>
> > INTERROR(pats_ccomp_dynexp): hidexp_ccomp: hde0 =
> HDEarrinit(HSEapp(HSEcst(atstkind_t0ype); HSEs2exp(S2Eextkind(atstype_int)));
> HDEint(3); HDEi0nt(1); HDEi0nt(2); HDEi0nt(3))
>
>
> If I try this instead:
>
> typedef row = @[int][3]
> var row1:row = @[int](1, 2, 3)
> var row2:row = @[int](4, 5, 6)
> var a = @[row][2](row1, row2)
> val a12 = a[1].[2]
>
> … Postiats can compile it, but I then I have numerous error while
> compiling C. Many of these errors mentions ATSstatmpdec and there are also
> C syntax errors.
>
> --
> You received this message because you are subscribed to the Google Groups
> "ats-lang-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ats-lang-users+unsubscr...@googlegroups.com.
> To post to this group, send email to ats-lang-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/ats-lang-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ats-lang-users/9695cba1-b5c0-463e-9356-60035b1bb142%
> 40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ats-lang-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLpehPjppMhcBfqevkwuKAynk8oEjs9ytaxa0Y6_CPXSww%40mail.gmail.com.


Re: Postiats and C errors with array

2018-08-06 Thread Julian Fondren
Incidentally, this works:

#include "share/atspre_staload.hats"

typedef row = @(int, int, int)
val row1: row = (1, 2, 3)
val row2: row = (4, 5, 6)
var a = @[row](row1, row2)
val a12 = a[1].2

implement main0() = println!(a12)


On Monday, August 6, 2018 at 6:51:51 PM UTC-5, Yannick Duchêne wrote:
>
> I’m unsure if it’s something wrong with what I wrote (ex. may be it’s not 
> allowed) or with Postiats. The sample below type‑checks, but compilation 
> fails with an INTERROR message.
>
> The sample:
>
> typedef row = @[int][3]
> val row1:row = @[int](1, 2, 3)
> val row2:row = @[int](4, 5, 6)
> var a = @[row][2](row1, row2)
> val a12 = a[1].[2]
>
> On the second line, it fails with:
>
> > INTERROR(pats_ccomp_dynexp): hidexp_ccomp: hde0 = 
> HDEarrinit(HSEapp(HSEcst(atstkind_t0ype); 
> HSEs2exp(S2Eextkind(atstype_int))); HDEint(3); HDEi0nt(1); HDEi0nt(2); 
> HDEi0nt(3))
>
>
> If I try this instead:
>
> typedef row = @[int][3]
> var row1:row = @[int](1, 2, 3)
> var row2:row = @[int](4, 5, 6)
> var a = @[row][2](row1, row2)
> val a12 = a[1].[2]
>
> … Postiats can compile it, but I then I have numerous error while 
> compiling C. Many of these errors mentions ATSstatmpdec and there are also 
> C syntax errors.
>

-- 
You received this message because you are subscribed to the Google Groups 
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ats-lang-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/7d1cff0f-0d00-4296-966d-1d31b02146bb%40googlegroups.com.