Thought I had 15-2 worked out. Starting with Stephen's code in the chapter that uses indexOfObjectPassingTest:, I thought, just change the comparison to find a substring match and you're there. And that seemed to work. Compiles without errors and runs to completion. But then I happened to run it multiple times in a row, and after about 5 or 6 consecutive runs (or sometimes it takes 20), a strange thing starts to happen. The program starts exiting early. No errors or crashes. It exits with code 0, but it exits early and not always at the same point. It all seems random. Cleaning does not seem to help. So, I tried going back to the lookup method exactly as it is presented in the book just to make sure that works, and I still see the same odd behavior. I'm not really sure what code to post here. The lookup method is as presented in the book. In main I am simply using it like this:
[[myBook lookup:@"Stephen Kochan"] print];
Maybe the most useful thing is a view of the output. I've attempted to attach a screen capture of the output window as I run the program about 17 times consecutively. You will see that it exits early about 4 or 5 times and not always at the same point.http://youtu.be/scrWxtryw8Q
So maybe the first question is, for those of you who have this working, if you run the program many times consecutively (which you may not have done before), does anyone see this anomaly? If I had only run this once or twice, I could have easily called it good and moved on, but now I am quite stumped.