rewrite `define-memo`

This pull request attempts to generalize `define-memo` to any number of args.