#2816 closed defect (fixed)
Support threaded reductions language extension
Reported by: | Martin Sjölund | Owned by: | Martin Sjölund |
---|---|---|---|
Priority: | high | Milestone: | 1.9.1 |
Component: | MetaModelica | Version: | trunk |
Keywords: | Cc: | Per Östlund |
Description
Support threaded reductions language extension:
function testThreadedReduction output list<Integer> l1 := list(a+b threaded for a in 1:2, b in 3:4); // {1+3,2+4} output list<Integer> l2 := list(a+b for a in 1:2, b in 3:4); // {4,5,5,6} end testThreadedReduction;
Change History (3)
comment:1 by , 10 years ago
Status: | new → assigned |
---|
comment:2 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:3 by , 7 years ago
Can this be implemented for for-loops as well?
threaded for a in list1, b in list2 loop sum := sum + a*b; end for;
Would be syntactic sugar for
rest := list2; for a in list1 loop b::rest := rest; sum := sum + a*b; end for; if not listEmpty(rest) fail();
and would avoid temporary list creation as in
tmp := list(a*b threaded for a in list1, b in list2); for t in tmp loop sum := sum + t; end for;
Note:
See TracTickets
for help on using tickets.
Fixed in r22279.