first cut of much more sophisticated inference (doesn't work for map, does work with others in inference-tests directory)