Svag matchende rim for recursive function