creates recursive palindrome function