Jon Rowe says:
| The gist is as follows. Move the stack into a list "thestack". Then
| one by one put things from this list back on to the stack. At each
| stage, try running p. If it throws a STACK EMPTY mishap, then you need
| to try more arguments. If not, then you've done it. Make a new list
| out of the results on the stack and throw the remnant of "thestack"
| back on to the stack. (The word "elegant" does not exactly leap to
| mind...)
Doesn't work.
(a) p may be a variadic function: it might take up to n arguments,
looking at the stack depth to see how many there are. (Such a p is
disgusting anyway, but if we could trust pdnargs, Jon wouldn't have
his problem anyway.)
(b) p may have side-effects before getting extra values off the stack,
so several incomplete runs of it may have unfortunate results.
In short, we need a trustworthy pdnargs, which probably requires
compile-time analysis. Ha.
Regards, | "In the realms of detection, superficiality is only skin-deep."
Kers. | [The Beiderbeck Connection]
|