semantic: Nest foreach aggregate function.