-1

We have a list of items and we want to compare element by element with another list of items and the result is a list with items that don´t have items in both lists or duplicates items.

For Example:

L1={S1, S2, S3, S4, S5, S6, S7, S8, S9, S10}, L2={S1, S4, S7, S9}, listresult={S2, S3, S5, S6, S8, S10}

  • 1. Lists don´t exists in OCL. I want to understand you mean Sequences (which are ordered -may be irrelevant-, and accept duplicates -very relevant-). 2. Your example is very unfortunate, since it doesn´t help the clarify the above. 3. I can´t neither figure out if an element present in L2 which is not present in L1 should be included in the final result. A better example would have helped here. – ASBH Nov 17 '13 at 13:15

1 Answers1

0

Providing the description is not good enough, I´ll try to figure out a solution for you anyway:

let L1 : Sequence(String) = Sequence {'1', '2', '3', '4', '5', '6', '7', '8', '9', '10'}, 
    L2 : Sequence(String) = Sequence {'1', '4', '7', '9' } 
in L1->reject(x | L2->includes(x))

results:
'2'
'3'
'5'
'6'
'8'
'10'
ASBH
  • 541
  • 2
  • 6