LEJ
LEJ

Reputation: 1958

Alloy - Remove middle atom from tuple

I currently have three atoms class, pupil, grade and a tuple mark in the format class->pupil->grade. How can I return a tuple in the format class->grade so that I can see the grades a specific pupil has got in each class as a class/grade binary relation? Assume there is only one pupil in the system. Thanks!

Upvotes: 0

Views: 121

Answers (1)

Loïc Gammaitoni
Loïc Gammaitoni

Reputation: 4171

One way I can imagine to achieve this is using set comprehension as follows:

fun getGrade[p:Pupil]: Class->Grade {
  {c:Class,g:Grade|c->p->g in mark}
}

Upvotes: 2

Related Questions