@mfvonh Well, P is a function that, when called, changes itself
It changes itself into a function that, when called, exits the scan returning that first argument
So, the scan will only return that second time P is applied.
But it's hard to undertstand, I don't have it fresh in my mind
My implementatin takes a different approach, probably simpler, that used to work almost always like Wizards (haven't tried in v10)
At the time, I must have seen a difference, because I created a super step function with the option "Attributes" that, if True, used WizardÅ› , adn if False, used mine. Why I did that, don't remember
@Rojo Yeah it's strange. I understand what it does, but still don't have good intuition about it. For example if I change TraceDepth -> 2 and then do step[4 * (2 + 3)] I get Times. Same if I set it to any number greater than 2. But Times is never by itself in the Trace.
@Rojo well actually I guess my question is, if I do that TraceScan line with TraceDepth->1 I never see ReplaceAll as a head. Why does it show up with TraceDepth > 1 ?
@acl I don't know. Theoretically it should be linear in the number of vertices PLUS the number of edges, or something like that. I've seen weird complexity from Mma before.
@acl. I ran your code on V10. About 30 seconds later, without having done anything new with MMA, I got beep and found that the kernel had crashed. Further, the suggestions bar turned red and displayed an error message.
@acl. No, nothing lost. Wasn't doing anything else with MMA at the time.
There are lot of places in MMA where that sort of thing happens. Consider maxD]= OrderDistribution[{NormalDistribution[], n}, n]; NestList[{#[[1]] + 1, First@AbsoluteTiming[Mean[maxD]] /. n -> #[[1]] + 1]} &, {1, 0}, 5] returns {1, 0}, {2, 1.217399}, {3, 1.220662}, {4, 1.221624}, {5, 1.220797}, {6, 247.914156}}. Note huge step at 6.
> When a string is returned as a result, the Wolfram Language accesses the memory to convert it to its own internal string format, but does not attempt to free the memory. Thus, if your program allocates a string for a result, it also needs to free that memory, but in a separate function from the one setting the string result, since the Wolfram Language needs to access the string memory after the library function has returned.
So to return a bloody string, I need to define two library link functions, one that returns it, and one that has to be called right after to release the memory!?!
@acl, Perhaps it is OS X specific. WRI tech support said they reproduced it and said they would look into it. It just finished on V10. No change in the timings.