Navigation
Synopsis Select a field (column) from a list relation value.
Syntax Exp . Name
Types
Exp Exp . Name
lrel[T1 L1, T2 L2, ... ] list[Ti]
Description Exp should evaluate to a list relation that has an i-th field label Li that is identical to Name. Return a list with all values of that field. Name stands for itself and is not evaluated.
Examples
rascal>lrel[str street, int nm] R = [<"abc", 1>, <"abc", 2>, <"def", 4>, <"def", 5>];
lrel[str street,int nm]: [
  <"abc",1>,
  <"abc",2>,
  <"def",4>,
  <"def",5>
]
rascal>R.street;
list[str]: ["abc","abc","def","def"]

Questions
Question [1].
Given
lrel[str animal, int nlegs] legs = [<"bird", 2>, <"dog", 4>, <"human", 2>, <"snake", 0>, <"spider", 8>, <"millepede", 1000>, <"crab", 8>, <"cat", 4>];
legs.animal == 

Question [2].
Given
lrel[str animal, int nlegs] legs = [<"bird", 2>, <"dog", 4>, <"human", 2>, <"snake", 0>, <"spider", 8>, <"millepede", 1000>, <"crab", 8>, <"cat", 4>];
legs.nlegs == 



Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.