NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Making it even more compact... (Score:1)
Re:Making it even more compact... (Score:2)
Yes, it could potentially be made slightly shorter... but I like the straightforward clarity of the above. An advantage of the above approach is that it would work for almost any stack pattern -- including things that don't fit the ".push( fn(.pop) )" model. For example, to add a 'say' operator that displays the top value of the stack (without removing it):
I can also imagine functions that rotate or swap the top N operands, or the like. Trying to wedge those into a standard .push/.pop sequence seems a little less straightforward than what we have above.
I'd still be interested in seeing the solution you have in mind, even if Rakudo doesn't compile/run it yet. In fact, we'd be a bit more likely to make it do that if we had an example to work to. :-)
Thanks!
Pm
Reply to This
Parent
Re: (Score:1)