#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)
--
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+unsubscribe@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.
@[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-lan...@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-user...@googlegroups.com.
To post to this group, send email to ats-lan...@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-user...@googlegroups.com.
To post to this group, send email to ats-lan...@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.
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)
@[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.
[…]
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.
[…] 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+unsubscribe@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.
>>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+unsubscribe@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
>>multiple dimension array types is not supported,We will support mutiple dimension arrays in ATS3. Such arraysare a necessity for many machine learning algorithms.
>>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.
--
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+unsubscribe@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.
>>Python surprisingly does not have direct support for arrays,Python is not famous for being effcient :)