In article <3C2B27F7.6009@ed.ac.uk>,
Stephen Isard <S.IsardDeleteThis@ed.ac.uk> wrote:
>Pete Goodeve wrote:
>> Umm. That won't be very good if something is already on the stack
>> when echo() is called, will it?
>You're right, of course. I wasn't clear what the point of this exercise
>was. You could call stacklength() on entry to the function and then
>take just the new items off the stack at the end. It would save you
>making repeated calls to consstring.
Having done quite a bit more experimentation and program-construction
since, one of the things that strikes me about a lot of Pop-11 is its
-- shall we say? -- cavalier use of the stack...
There seem to be a number of functions that dump arbitrary numbers of
things on the stack, without giving any direct indication of how many
there might be. (On the other hand, 'deststring' for example does it
"right" -- putting the number of items on top.)
'explode' for instance just dumps whatever its given, although here
I suppose you usually know how big the thing you're exploding is.
Worse is the procedure I came across while looking for a way to split
strings. I needed to break a string into segments at "=" characters,
and at first sight 'sys_parse_string(string, sepchar)' looked ideal.
However, it puts the resulting segments on the stack, so in the general
case you'd *have* to use your stacklength checking mechanism, which seems
inelegant at least!
There is a variant 'sysparse_string" which makes a list -- just what
I want! -- but it *only* splits at space characters! Very strange.
I ended up doing it with 'locchar' and a couple of 'substring's, but
I hoped there was a ready-made solution.
Cheers,
-- Pete --
>
>Stephen Isard
|