# How to create value of type stamped\_t (a, x)?

**URL:** https://discourse.ats-lang.org/t/how-to-create-value-of-type-stamped-t-a-x/162
**Category:** Google Group
**Created:** [June 18, 2015, 1:18pm UTC](https://discourse.ats-lang.org/t/how-to-create-value-of-type-stamped-t-a-x/162 "2015-06-18T13:18:45Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)
#### Post date: [June 18, 2015, 1:18pm UTC](https://discourse.ats-lang.org/t/how-to-create-value-of-type-stamped-t-a-x/162/1 "2015-06-18T13:18:45Z")

</div>

Yes, you need a cast.On Thu, Jun 18, 2015 at 8:54 AM, Kiwamu Okabe [kiw...@debian.or.jp](mailto:kiw...@debian.or.jp) wrote:

> Hi all,
> 
> Today I read interfaces of libats/SATS/gfarray.sats.
> 
> fun{a:t@ype}  
> gfarray\_set\_at  
> {l:addr}  
> {x:int}{xs1:ilist}{xs2:ilist}  
> {i:int}  
> (  
> pf1: UPDATE (x, xs1, i, xs2)  
> , pf2: !gfarray\_v (a, l, xs1) \>\> gfarray\_v (a, l, xs2)  
> | p: ptr l, i: size\_t i, x: stamped\_t (a, x)  
> ) :\<!wrt\> void // end of [gfarray\_set\_at]
> 
> The gfarray\_set\_at function need stamped\_t (a, x) type to change  
> entity of the array.
> 
> How to create value of type stamped\_t (a, x)?  
> Need to cast for it?
> 
> ## Best regards,
> 
> Kiwamu Okabe at METASEPI DESIGN
> 
> –  
> 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/CAEvX6dkpUOnweJWKn1SQ7B0qpOJsWos3r\_8OCT1%2B\_Q6RzsuLnA%40mail.gmail.com](https://groups.google.com/d/msgid/ats-lang-users/CAEvX6dkpUOnweJWKn1SQ7B0qpOJsWos3r_8OCT1%2B_Q6RzsuLnA%40mail.gmail.com)  
> .

---

<div class="post-metadata">

### Author: ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)
#### Post date: [June 19, 2015, 3:34am UTC](https://discourse.ats-lang.org/t/how-to-create-value-of-type-stamped-t-a-x/162/2 "2015-06-19T03:34:37Z")

</div>

Done.

castfn stamp\_t : {a:t@ype} (a) → [x:int] stamped\_t(a, x)  
castfn stamp\_vt : {a:vt@ype} (a) → [x:int] stamped\_vt(a, x)On Thursday, June 18, 2015 at 10:42:08 PM UTC-4, Kiwamu Okabe wrote:

> On Fri, Jun 19, 2015 at 8:06 AM, Hongwei Xi \<[gmh...@gmail.com](mailto:gmh...@gmail.com) \<javascript:\>\> wrote:
> 
> > The following function is a _safe_ cast:
> > 
> > {a:t@ype} (a) → [x:int] stamped\_t(a, x)
> 
> ## Use castfn? How about define the function at prelude/basics\_dyn.sats?
> 
> Kiwamu Okabe at METASEPI DESIGN

---

<div class="post-metadata">

### Author: ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)
#### Post date: [June 18, 2015, 11:06pm UTC](https://discourse.ats-lang.org/t/how-to-create-value-of-type-stamped-t-a-x/162/3 "2015-06-18T23:06:45Z")

</div>

The following function is a _safe_ cast:

{a:t@ype} (a) → [x:int] stamped\_t(a, x)On Thu, Jun 18, 2015 at 9:18 AM, Hongwei Xi [gmh...@gmail.com](mailto:gmh...@gmail.com) wrote:

> Yes, you need a cast.
> 
> On Thu, Jun 18, 2015 at 8:54 AM, Kiwamu Okabe [kiw...@debian.or.jp](mailto:kiw...@debian.or.jp) wrote:
> 
> > Hi all,
> > 
> > Today I read interfaces of libats/SATS/gfarray.sats.
> > 
> > fun{a:t@ype}  
> > gfarray\_set\_at  
> > {l:addr}  
> > {x:int}{xs1:ilist}{xs2:ilist}  
> > {i:int}  
> > (  
> > pf1: UPDATE (x, xs1, i, xs2)  
> > , pf2: !gfarray\_v (a, l, xs1) \>\> gfarray\_v (a, l, xs2)  
> > | p: ptr l, i: size\_t i, x: stamped\_t (a, x)  
> > ) :\<!wrt\> void // end of [gfarray\_set\_at]
> > 
> > The gfarray\_set\_at function need stamped\_t (a, x) type to change  
> > entity of the array.
> > 
> > How to create value of type stamped\_t (a, x)?  
> > Need to cast for it?
> > 
> > ## Best regards,
> > 
> > Kiwamu Okabe at METASEPI DESIGN
> > 
> > –  
> > 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/CAEvX6dkpUOnweJWKn1SQ7B0qpOJsWos3r\_8OCT1%2B\_Q6RzsuLnA%40mail.gmail.com](https://groups.google.com/d/msgid/ats-lang-users/CAEvX6dkpUOnweJWKn1SQ7B0qpOJsWos3r_8OCT1%2B_Q6RzsuLnA%40mail.gmail.com)  
> > .
