receive-student-scores.taq

$ java -jar taq.jar receive-student-scores

Running query marks in global scope 
student_marks(report=George english:b+ maths:b- history:a-)
student_marks(report=Sarah english:c+ maths:a history:b+)
student_marks(report=Amy english:b maths:a- history:e+)

Description

receive-student-scores.taq demonstrates a function returning an axiom list that is passed to an attached receiver termplate . The name given to the list is the same as that of the function. The axiom list content is declared as an archetype declaration

$ template<axiom> alpha_grades (string subject, string mark)

This list is readily identified in the receiver by it’s name - “convert_grades”. A cursor is bound to this list by using the same name

flow school.convert_grades(english, maths, history) {

cursor<axiom> convert_grades


$ template<axiom> alpha_grades (string subject, string mark)

axiom list grades
(student, english, maths, history)
{"George", 15, 13, 16}
{"Sarah", 12, 17, 15}
{"Amy", 14, 16, 6}

scope school(provider = "school.SchoolFunctionProvider")
{ function axiom<alpha_grades> convert_grades( integer marks... ) }

flow score
{
export list<axiom> student_marks,
string student
}
(
flow school.convert_grades(english, maths, history) {
string report = student,
cursor<axiom> convert_grades,
list<term> item,
{ ?? (item = convert_grades++)
report += " " + item->subject + ":" + item->mark },
student_marks += axiom { report }
}
)

query marks(grades : score)