Opened 10 years ago

Last modified 10 years ago

#2819 new enhancement

List comprehensions that create zero or multiple lists — at Initial Version

Reported by: Per Östlund Owned by: Martin Sjölund
Priority: normal Milestone: Future
Component: MetaModelica Version: trunk
Keywords: Cc:

Description

It would be nice if list comprehensions were a bit more flexible regarding the amount of lists created, so that something like this would work (possibly with some other syntax):

function f1
  input Integer x;
algorithm
  print(intString(x) + "\n");
end f1;

function f2
  input Integer x;
  output Integer y := x*2;
  output Integer z := x*3;
end f2;

function test
  output list<Integer> l1;
  output list<Integer> l2;
algorithm
  list(f1(i) for i in 1:3); // 'map' that doesn't return anything
  (l1, l2) := list(f2(i) for i in 1:3); // 'map' that returns two results for each element
end test;

Change History (0)

Note: See TracTickets for help on using tickets.