30 Splat
The splat expression * denotes the set of attributes of the current value.
For example, the following expression unwraps each course:
u.course.(*)
The output frame has the attributes of Course, rather than a single output
attribute named course.
Its denotation as a frame has the same result attributes as the Course type:
code=Code:String,
title=Title:String,
advanced=Advanced:Boolean,
department=D:Department,
prerequisite=P:Course,
session=S:Session,
assessment=A:Assessment,
enrolment=E:Enrolment
where
u.course(C)
∧ C.code(Code)
∧ C.title(Title)
∧ C.advanced(Advanced)
∧ C.department(D)
∧ C.prerequisite(P)
∧ C.session(S)
∧ C.assessment(A)
∧ C.enrolment(E)
Attribute sets
Attribute names are first-class values. The expression @title denotes the
attribute name title, and expressions such as {@code, @title} denote sets of
attribute names.
The splat expression * also evaluates to a set of attributes. Tuple construction
allows sets of attributes to be provided, so set operations can be used to manipulate
the output attributes.
The set operators ∩, ∪ and ∖, and the set tests ⊂, ⊃, ⊆, ⊇,
⊄, ⊅, ∈ and ∉, work as expected on sets of attributes.
Removing attributes
Because * denotes a set of attributes, set operations can be used to shape the
output attributes. This expression unwraps each course except for title:
u.course.(* \ {@title})
The output has every Course attribute except title.
Adding selected attributes
Splat can be combined with ordinary path tails in tuple construction:
u.course.(* \ {@department}, department.name as departmentName)
This unwraps each course, removes the department attribute, and adds the
department name under the output attribute departmentName.
Name clashes
Unwrapping can introduce name clashes. If two splatted values have attributes with the same name, rename or remove attributes before combining them:
u.enrolment.(* \ {@student}, student.name as studentName)
The splat exposes the enrolment attributes except student; the renamed path tail
adds the student's name.