add q expressions
head and tail implement