Implement polymorphic recursion