Tuples/Records in the statics

Hi all,

I know we have datasorts, but do we have something similar to build up tuples records of sorts? I know I can just use a single-constructor datasort, just wondering if there’s something more direct.

~Shea

Is there any way to “unpack” datasorts, some kind of scase?> On Feb 23, 2015, at 2:45 PM, Hongwei Xi gmh...@gmail.com wrote:

There is no direct support for tuples in the statics.

On Mon, Feb 23, 2015 at 2:19 PM, Shea Levy <sh...@shealevy.com mailto:sh...@shealevy.com> wrote:
Hi all,

I know we have datasorts, but do we have something similar to build up tuples records of sorts? I know I can just use a single-constructor datasort, just wondering if there’s something more direct.

~Shea


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 mailto:ats-lang-users...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com mailto:ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/B75CEE5A-16BC-472F-B044-5AB8277921EB%40shealevy.com https://groups.google.com/d/msgid/ats-lang-users/B75CEE5A-16BC-472F-B044-5AB8277921EB%40shealevy.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 mailto:ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com mailto:ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLoiXvgSx1OKTLo%2B3%3DN_P0qqHvYaZ06kCEta30o9G-Ldfw%40mail.gmail.com https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLoiXvgSx1OKTLo%2B3%3DN_P0qqHvYaZ06kCEta30o9G-Ldfw%40mail.gmail.com?utm_medium=email&utm_source=footer.

The ideal would be something like (for an ini parser I’m playing with):

sortdef loc_and_count = @{ loc = addr, count = int }
vtypedef sized_array (a:t@ype, lc:loc_and_count) = (@[a][lc.count]@[lc.loc]|@{ sz = int(lc.count), addr = ptr(lc.loc) })
vtypedef ini_entry (section_lc: loc_and_count, key_lc: loc_and_count, value_lc: loc_and_count) = @{ section=sized_array(section_lc), key=sized_array(key_lc), value=sized_array(value_lc) }

Without records in the statics, something like this would be nice:

datasort loc_and_count = loc_and_count of (addr, int)
vtypedef sized_array (a:t@ype, lc:loc_and_count) = case lc of (l, i) → (@[a][i]@[l]|@{ sz = int(i), addr = ptr(l) })
vtypedef ini_entry (section_lc: loc_and_count, key_lc: loc_and_count, value_lc: loc_and_count) = @{ section=sized_array(section_lc), key=sized_array(key_lc), value=sized_array(value_lc) }

These are of course just conveniences, but as it stands I need to name every static variable repeatedly.

Thanks,
Shea> On Feb 23, 2015, at 4:00 PM, Hongwei Xi gmh...@gmail.com wrote:

Could you write some pseudo code?

On Mon, Feb 23, 2015 at 3:56 PM, Shea Levy <sh...@shealevy.com mailto:sh...@shealevy.com> wrote:
Is there any way to “unpack” datasorts, some kind of scase?

On Feb 23, 2015, at 2:45 PM, Hongwei Xi <gmh...@gmail.com mailto:gmh...@gmail.com> wrote:

There is no direct support for tuples in the statics.

On Mon, Feb 23, 2015 at 2:19 PM, Shea Levy <sh...@shealevy.com mailto:sh...@shealevy.com> wrote:
Hi all,

I know we have datasorts, but do we have something similar to build up tuples records of sorts? I know I can just use a single-constructor datasort, just wondering if there’s something more direct.

~Shea


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 mailto:ats-lang-users...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com mailto:ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/B75CEE5A-16BC-472F-B044-5AB8277921EB%40shealevy.com https://groups.google.com/d/msgid/ats-lang-users/B75CEE5A-16BC-472F-B044-5AB8277921EB%40shealevy.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 mailto:ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com mailto:ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLoiXvgSx1OKTLo%2B3%3DN_P0qqHvYaZ06kCEta30o9G-Ldfw%40mail.gmail.com https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLoiXvgSx1OKTLo%2B3%3DN_P0qqHvYaZ06kCEta30o9G-Ldfw%40mail.gmail.com?utm_medium=email&utm_source=footer.


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 mailto:ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com mailto:ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/A73DD363-CCD5-494C-92FB-BA11268D0486%40shealevy.com https://groups.google.com/d/msgid/ats-lang-users/A73DD363-CCD5-494C-92FB-BA11268D0486%40shealevy.com?utm_medium=email&utm_source=footer.


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 mailto:ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com mailto:ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLpH5RkJSax5E7LQ0jmonnSKWp1BiwF_jr5pRVZT4Eke_w%40mail.gmail.com https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLpH5RkJSax5E7LQ0jmonnSKWp1BiwF_jr5pRVZT4Eke_w%40mail.gmail.com?utm_medium=email&utm_source=footer.

You can introduce some constants:

stacst: loc : loc_and_count → addr
stacst: count : loc_and_count → int

Then write lc.loc as loc(lc) and lc.count as count(lc).

What is a bit tricky is here is to tell the system of the following
equalities
when you need them:

loc(loc_and_count(l, c)) = l
count(loc_and_count(l, c)) = cOn Tuesday, February 24, 2015 at 6:59:55 AM UTC-5, Shea Levy wrote:

The ideal would be something like (for an ini parser I’m playing with):

sortdef loc_and_count = @{ loc = addr, count = int }
vtypedef sized_array (a:t@ype, lc:loc_and_count) =
(@[a][lc.count]@[lc.loc]|@{ sz = int(lc.count), addr = ptr(lc.loc) })
vtypedef ini_entry (section_lc: loc_and_count, key_lc: loc_and_count,
value_lc: loc_and_count) = @{ section=sized_array(section_lc),
key=sized_array(key_lc), value=sized_array(value_lc) }

Without records in the statics, something like this would be nice:

datasort loc_and_count = loc_and_count of (addr, int)
vtypedef sized_array (a:t@ype, lc:loc_and_count) = case lc of (l, i) →
(@[a][i]@[l]|@{ sz = int(i), addr = ptr(l) })
vtypedef ini_entry (section_lc: loc_and_count, key_lc: loc_and_count,
value_lc: loc_and_count) = @{ section=sized_array(section_lc),
key=sized_array(key_lc), value=sized_array(value_lc) }

These are of course just conveniences, but as it stands I need to name
every static variable repeatedly.

Thanks,
Shea

On Feb 23, 2015, at 4:00 PM, Hongwei Xi <gmh...@gmail.com <javascript:>> wrote:

Could you write some pseudo code?

On Mon, Feb 23, 2015 at 3:56 PM, Shea Levy <sh...@shealevy.com <javascript:>> wrote:

Is there any way to “unpack” datasorts, some kind of scase?

On Feb 23, 2015, at 2:45 PM, Hongwei Xi <gmh...@gmail.com <javascript:>> wrote:

There is no direct support for tuples in the statics.

On Mon, Feb 23, 2015 at 2:19 PM, Shea Levy <sh...@shealevy.com <javascript:>> wrote:

Hi all,

I know we have datasorts, but do we have something similar to build up
tuples records of sorts? I know I can just use a single-constructor
datasort, just wondering if there’s something more direct.

~Shea


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...@googlegroups.com <javascript:>.
To post to this group, send email to ats-l...@googlegroups.com
<javascript:>.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/B75CEE5A-16BC-472F-B044-5AB8277921EB%40shealevy.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...@googlegroups.com <javascript:>.
To post to this group, send email to ats-l...@googlegroups.com
<javascript:>.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLoiXvgSx1OKTLo%2B3%3DN_P0qqHvYaZ06kCEta30o9G-Ldfw%40mail.gmail.com
https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLoiXvgSx1OKTLo%2B3%3DN_P0qqHvYaZ06kCEta30o9G-Ldfw%40mail.gmail.com?utm_medium=email&utm_source=footer
.


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...@googlegroups.com <javascript:>.
To post to this group, send email to ats-l...@googlegroups.com
<javascript:>.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/A73DD363-CCD5-494C-92FB-BA11268D0486%40shealevy.com
https://groups.google.com/d/msgid/ats-lang-users/A73DD363-CCD5-494C-92FB-BA11268D0486%40shealevy.com?utm_medium=email&utm_source=footer
.


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...@googlegroups.com <javascript:>.
To post to this group, send email to ats-l...@googlegroups.com
<javascript:>.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLpH5RkJSax5E7LQ0jmonnSKWp1BiwF_jr5pRVZT4Eke_w%40mail.gmail.com
https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLpH5RkJSax5E7LQ0jmonnSKWp1BiwF_jr5pRVZT4Eke_w%40mail.gmail.com?utm_medium=email&utm_source=footer
.

There is no direct support for tuples in the statics.On Mon, Feb 23, 2015 at 2:19 PM, Shea Levy sh...@shealevy.com wrote:

Hi all,

I know we have datasorts, but do we have something similar to build up
tuples records of sorts? I know I can just use a single-constructor
datasort, just wondering if there’s something more direct.

~Shea


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 http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/B75CEE5A-16BC-472F-B044-5AB8277921EB%40shealevy.com
.

Could you write some pseudo code?On Mon, Feb 23, 2015 at 3:56 PM, Shea Levy sh...@shealevy.com wrote:

Is there any way to “unpack” datasorts, some kind of scase?

On Feb 23, 2015, at 2:45 PM, Hongwei Xi gmh...@gmail.com wrote:

There is no direct support for tuples in the statics.

On Mon, Feb 23, 2015 at 2:19 PM, Shea Levy sh...@shealevy.com wrote:

Hi all,

I know we have datasorts, but do we have something similar to build up
tuples records of sorts? I know I can just use a single-constructor
datasort, just wondering if there’s something more direct.

~Shea


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 http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/B75CEE5A-16BC-472F-B044-5AB8277921EB%40shealevy.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 http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLoiXvgSx1OKTLo%2B3%3DN_P0qqHvYaZ06kCEta30o9G-Ldfw%40mail.gmail.com
https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLoiXvgSx1OKTLo%2B3%3DN_P0qqHvYaZ06kCEta30o9G-Ldfw%40mail.gmail.com?utm_medium=email&utm_source=footer
.


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 http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/A73DD363-CCD5-494C-92FB-BA11268D0486%40shealevy.com
https://groups.google.com/d/msgid/ats-lang-users/A73DD363-CCD5-494C-92FB-BA11268D0486%40shealevy.com?utm_medium=email&utm_source=footer
.