containers.xreate
No OneTemporary

File Metadata

Created
Thu, Jul 9, 12:02 AM

containers.xreate

/*
*
* Show-case for a automatic adjustment of container implementations based on actual operations.
* Possible implementations: llvm_array, llvm_const_array, on_the_fly(unwinded container)
*
*/
pass(dfa) {
operator map: (op(seqaccess)) -> impl(solid);
operator list_range: ()->impl(on_the_fly);
operator list: ()->impl(solid);
operator fold: (op(seqaccess));
operator index: (op(randaccess));
/* operator map: (op(seqaccess)) -> impl(llvm_array | on_the_fly); */
}
import raw("core/containers.lp");
testfunc = function: ()->bool
{
a1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] : [num];
a2 = [1 .. 100] : [num];
b = loop map (a1 -> el: num) : [num]
{2 * el;};
c = b : [num];
d = loop fold (a2->el: num, 0->acc: num): [num]
{acc + el;};
c[5]==d;
}

Event Timeline