"arrpsz" what is this exactly ?

65 views
Skip to first unread message

chotu s

unread,
Feb 11, 2014, 1:29:02 AM2/11/14
to ats-lan...@googlegroups.com
Hello,

Where is this function declared and what it does exactly ?

val A = (arrayptr) $arrpsz{int}(1,2,3,4,5,6)

It seems to take variable number of arguments  , and return a value of type arrayptr(int,6) .

How do I create a function that takes variable number of arguments of same type ?

Thanks





gmhwxi

unread,
Feb 11, 2014, 1:38:48 AM2/11/14
to ats-lan...@googlegroups.com
$arrpsz is not a function. It is a function-like construct for constructing arrays.
In ATS, identifiers beginning with the $ symbol often represent constructs that
are function-like. For example, $list, $list_vt, $tuple, $tuple_vt, $raise, etc.

$arrpsz{T}(...) gives you a value of the type arrayptrsize(T, N), where N is the
number of arguments.


>>How do I create a function that takes variable number of arguments of same type ?

Say this function is called foo.

Then you can give foo the following interface:

fun foo{n:int} (arrayptrsize (T, n)): ...

A call to foo is like: foo($arrpsz{T}(...))

chotu s

unread,
Feb 11, 2014, 6:53:52 AM2/11/14
to gmhwxi, ats-lan...@googlegroups.com

Variable argument does not seem to work. Can you give me a working code where say a fun takes 1 or more integers and return its sum or say simply returns an array whose elements are these integers.


By the way , I also cant find "arrayptrsize"  in any file .

Thanks


--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/ca3c544a-aba8-4a74-8762-76cbd5911b79%40googlegroups.com.

gmhwxi

unread,
Feb 11, 2014, 9:33:03 AM2/11/14
to ats-lan...@googlegroups.com, gmhwxi

chotu s

unread,
Feb 11, 2014, 10:26:19 AM2/11/14
to gmhwxi, ats-lan...@googlegroups.com
Thanks .  It now works (tested it and used it in my own code)  just fine :)


Reply all
Reply to author
Forward
0 new messages