Skip to main content

Set Comprehension

rascal-0.34.0

Synopsis

A set comprehension generates a set value.

Syntax

{ Exp₁, Exp₂, ... | Gen₁, Gen₂, ... }

Types

Exp₁Exp₂...{ Exp₁, Exp₂, ... \| Gen₁, Gen₂, ... }
T₁T₂...set[ lub( T₁, T₂, ... ) ]

Description

A set comprehension consists of a number of contributing expressions Exp₁, Exp₂, ... and a number of generators Gen₁, Gen₂, Gen₃, ... that are evaluated as described in Comprehensions.

Examples

rascal>{ N * N | int N <- [0 .. 10]};
set[int]: {16,64,1,9,81,4,0,49,36,25}
rascal>{ N * N | int N <- [0 .. 10], N % 3 == 0};
set[int]: {9,81,0,36}