Cache an intermediate variable in an one-liner

scala

Solution

You could do:

def palindrome(i: Int) = ((s:String) => s == s.reverse)(i.toString)

Problem

Can I somehow cache the `i.toString` in this simple definition of function? ``` def palindrome(i: Int) = i.toString == i.toString.reverse ``` I want to keep this function simple, w/o a classic multi-line, brace-enclosed function..

Original source