Understanding behavior of recursive functions - TypeDB