aggregate function

how can i create my own aggregate function in q?to try something i did following:-f1:{100+first x}when i do:-select f1 field from table1where field is an int, it gives ?type error…but if i do:-.q.f1: {first x+100}.Q[`a0],:.q.f1thenselect f1 field from table1works fine…what is the proper way of defining agg functions and what is the diffbetween .Q`a0 & .Q`a1?