![]() |
| ||||||||
Navigation |
Synopsis A set comprehension generates a set value.
Syntax
{ Exp1, Exp2, ... | Gen1, Gen2, ... }
Types
Description A set comprehension consists of a number of contributing expressions
Exp1 , Exp2 , ... and a number of
generators Gen1 , Gen2 , Gen3 , ... that are evaluated as described in Expressions/Comprehensions.
Examples
rascal>{ N * N | int N <- [0 .. 10]}; set[int]: {1,9,16,25,0,64,4,36,49,81} rascal>{ N * N | int N <- [0 .. 10], N % 3 == 0}; set[int]: {0,36,9,81} Questions
Question [1].
![]() ![]()
Question [2].
![]() ![]()
Question [3].
![]() ![]()
Question [4].
![]() ![]() ![]() |