Re: [OT] Stack Operation

2002-11-26 Thread Franck PORCHER
On Sat, 23 Nov 2002, Jonathan M. Hollin wrote: > Can anyone offer me some pointers (pun intended) on how to implement a > stack in Perl with an array? The description you give does not describe an 'academic' stack... You would probably need to read some good Perl books. I suggest the "classical"

Re: [OT] Stack Operation

2002-11-24 Thread Stas Bekman
Tim Tompkins wrote: But push()ing and pop()ing is not what the original poster wants to do. He wants to splice(). It doesn't matter if he's talking about treating a stack in the traditional sense, and it doesn't matter that splice is not as efficient as push or pop. What matters is that he know

Re: [OT] Stack Operation

2002-11-24 Thread Tim Tompkins
But push()ing and pop()ing is not what the original poster wants to do. He wants to splice(). It doesn't matter if he's talking about treating a stack in the traditional sense, and it doesn't matter that splice is not as efficient as push or pop. What matters is that he knows how to accomplish w

RE: [OT] Stack Operation

2002-11-24 Thread Ryan Thompson
Tim Tompkins wrote to Ben Mathews: > Honestly, I didn't see where any of those libs would assist what the > poster wanted to accomplish. What's wrong with splice? For implementing a traditional stack, the splice operation (or any operation which has to rearrange the list every time an element is

Re: [OT] Stack Operation

2002-11-24 Thread Ryan Thompson
Jonathan M. Hollin wrote to [EMAIL PROTECTED]: > Can anyone offer me some pointers (pun intended) on how to implement > a stack in Perl with an array? Perl has two simple builtin functions for treating an array like a stack. See push() and pop(). Basically: my @stack; push @stack, "e3"; push

RE: [OT] Stack Operation

2002-11-23 Thread Tim Tompkins
ack&mode=module > > Ben > > > > -Original Message- > > From: Jonathan M. Hollin [mailto:[EMAIL PROTECTED]] > > Sent: Saturday, November 23, 2002 6:59 AM > > To: [EMAIL PROTECTED] > > Subject: [OT] Stack Operation > > > > Can anyone offer me

RE: [OT] Stack Operation

2002-11-23 Thread Ben Mathews
Don't reinvent the wheel. http://search.cpan.org/search?query=stack&mode=module Ben > -Original Message- > From: Jonathan M. Hollin [mailto:[EMAIL PROTECTED]] > Sent: Saturday, November 23, 2002 6:59 AM > To: [EMAIL PROTECTED] > Subject: [OT] Stack Operation

Re: [OT] Stack Operation

2002-11-23 Thread Larry Leszczynski
Hi Jonathan - > Can anyone offer me some pointers (pun intended) on how to implement a > stack in Perl with an array? This is a basic Perl question, not a mod_perl question, so you might want to read up in "Programming Perl" or "Learning Perl". But the thing you want to look at is "splice". For

[OT] Stack Operation

2002-11-23 Thread Jonathan M. Hollin
Can anyone offer me some pointers (pun intended) on how to implement a stack in Perl with an array? I need to have an array of elements as follows: 0 - e1 1 - e2 2 - e3 ... And I need to be able to insert items: e4 needs to go into $array[1]. 1 and 2 need to move down (or up or left or right -