APL script that implements helper functions