Meeting at the Chapel

Let's say I create tuples, and I want to concatenate them as they become available. How can I do it? The following is an addition on the elements:

if ts = ("foo", "cat"),t = ("bar", "dog")

ts += tIt gives ts = ("foobar", "catdog"),

but i really want to ts = (("foo","cat"),("bar","dog")).

So, I guess the first question is, β€œDoes Chapel support tuple concation?”, Then β€œdoes there exist a binary operator / function for it?”, Then β€œif not, is this a good way to do this?” and finally, "make my life easier if you know a better lifestyle."

Please ask questions in order.

I appreciate the help!

+6
source share
1

, " Chapel ?"

, "" : (1) Chapel , , (2) . , ts

ts = ("foo", "cat")

2*string ( "2- " ), - (("foo","cat"),("bar","dog")), 2*(2*string) ( "2- 2 - " ). , (2), ( "" "2- " ) , , ().

" /?"

- , .

" , ?"

, . , ts, , :

const ts2 = (ts, t);

, , , , - ( ).

, , , 1D () . :

use List;

var listOfTups: list(2*string);

listOfTups.append(("foo", "cat"));
listOfTups.append(("bar", "dog"));

writeln(listOfTups);

:

var arrOfTups: [1..0] 2*string;

arrOfTups.push_back(("foo", "cat"));
arrOfTups.push_back(("bar", "dog"));

writeln(arrOfTups);

, ( , parallelism, ..), - .

, , " , ".

, , , "varargs" Chapel . , :

proc myFunc(x...) {
  writeln(x.type:string);
}

myFunc(("foo", "cat"), ("bar", "dog"));

:

2*2*string
+6

All Articles