Skip to content

Instantly share code, notes, and snippets.

@Ciechan
Created May 25, 2014 20:59
Show Gist options
  • Save Ciechan/110cd5eea24222d9a80e to your computer and use it in GitHub Desktop.
Save Ciechan/110cd5eea24222d9a80e to your computer and use it in GitHub Desktop.
This seems to tail call correctly with jmp instead of call
+ (NSUInteger)lengthOfListWithHead:(ListNode *)node count:(NSUInteger)count {
if (!node)
return count;
else {
__unsafe_unretained id n = node.next;
return [self lengthOfListWithHead:n count:(count + 1)];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment