I have a function that takes in sequences of values (as a list), and recursively removes the largest element from that sequence as part of its computation. Some of these sequences can be quite large, but I suspect that they often have common subsequences. So I want to memoize my function, but I don't want to memoize it for very large sequences, only smaller sequences which these larger sequences might have in common. I tried something like this,
f[sequence_?Length[#] < 16 &] := f[sequence] = f[sequence] where f is already defined elsewhere. Probably I would need to memoize for larger sequences, but that's the idea of it. However, I hit the recursion limit when I call this function.

f[sequence]on the right-hand side actually some expression involvingsequence? And as far as the left-hand side goes, I think you need to dof[sequence_?(Length[#] < 16 &)]because of operator precedence issues. $\endgroup$f[sequence]on the right hand side is defined likef[sequence_] := .... Adding parenthesis doesn't change the error I get. $\endgroup$