Hi Ian,
There has been discussion here about supporting user defined functions. Last I read they're still under consideration.
However, for your scenario, I think using a datagroup mapping the host, paths and pool would be more efficient (and possible in current versions). If you're on v10, you can use the new class command (
Click here). For 9.x, you can use the findclass or TCL list commands to look up the corresponding pool.
For examples, you can check the wiki pages or search the iRules forums for findclass, "http::host", class, etc.
Another option would be to use the ProxyPassV9 or ProxyPassV10 iRules to do this:
iRule codeshare (
Click here)
Aaron