The code in Re: Howto avoid large hard-coded else-if function calls seems to be an almost exact match for your requirement.
In reply to Re: subroutines - creating a custom subroutine and 'subroutine redefined' errors
by BrowserUk
in thread subroutines - creating a custom subroutine and 'subroutine redefined' errors
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |