Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / How do I use LISTS, STACKS and QUEUES?

Author
Message
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 10th Jul 2003 16:22
I am completely familiar with 'normal' DIMensioned arrays. However what I doing now DIMensioned arrays are not suitable. I have studied the user manual and it would seem that what I need is to use QUEUED arrays, however the manual is very sketchy about what exactly they are how to use them. The help files are no better and I can't find anything in any tutorials.

What I would like to know is:

1) How do I set up a QUEUE?
2) How do I write to it?
3) How do I read from it?

Thank you
Puffy
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United States
Posted: 10th Jul 2003 16:30
=P You talking about an array right... maybe this will clear it up...

dim Puffy(2,2)

now this consists of

Puffy(1,1)
Puffy(1,2)
Puffy(2,1)
Puffy(2,2)

right?

Now if I wanna apply a value to one of those
Puffy(1,1)=5
Puffy(1,2)=6
Puffy(2,1)=10
Puffy(2,2)=20

ok... now to read
Print Puffy(1,1)... right?

heres some code to mess with... oh and remember when your done with an array to undim it...



EVERYONE LOVES THE PUFF!... =\
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 10th Jul 2003 16:57
Thanks for the input - but, no that is not what I mean. I understand your 'puffy' example and have been using arrays like that since the BBC Micro.

What I need help with is the commands :

ADD TO QUEUE
ARRAY INDEX TO QUEUE
REMOVE FROM QUEUE

And any other associated commands.

Thanks

Puffy
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United States
Posted: 10th Jul 2003 17:10
K... lemme take a look at the help files...

EVERYONE LOVES THE PUFF!... =\
Eddie Gordo
21
Years of Service
User Offline
Joined: 14th Jan 2003
Location: Ohio - USA
Posted: 10th Jul 2003 17:14 Edited at: 10th Jul 2003 17:17
i got this one,

a QUEUE is an array thats used like a list. its a first in first out list of variable, when you ADD TO QUEUE it puts that variable at the top of the QUEUE, and REMOVE removes the current out-variable from the first spot of the QUEUE and puts the next out-variable in the front of the QUEUE...i think...its useful for FTP programs and multiplayer...

In our hearts and minds we keep the powers of love, hope and the hidden powers of evil in which we can mold a hero or daemon of ourselves-Book of Enoch Chapter III
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 10th Jul 2003 17:38
Thanks - but how do I use it in practical terms I mean if I have:

a=1
b=2
c=3

how do I put them in a QUEUE and then how do I get them back out again?

Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 10th Jul 2003 18:00
don`t worry about them!, AFAIK they are currently broken, when you add to a queue/list you get garbage back, just stick to oversized arrays for now or memblocks, you might even be able to save on memory if your stored values are no higher then 255 , hopefully they will be fixed in patch 5 because like you say they will be realy usefull, cheers.

Mentor.

ps: if you must know, you increase the size of the array with the add command and use the array pointer (array index to queue) to find the slot (for example a(56)) that is next and then to remove the top entry use remove from queue, but like I say they tend not to work so nobody uses them.

Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 10th Jul 2003 18:03
Thanks a lot Oversizing it is then.

Fingers crossed for patch 5 eh?

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 10th Jul 2003 22:28
There are only *two* broken commands in the array/stack/queue/list command set. All of the rest work fine.


Here are working examples of stacks and queues that I posted a little while back.

Stacks:



Queues:



For your information, the broken commands are ARRAY INSERT AT TOP (both versions) and ARRAY INSERT AT ELEMENT. This has been confirmed to me by Lee, who has also fixed these for Update 5.
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 10th Jul 2003 22:49
IanM You are a star! That is exactly what I needed it should make (it WILL make) my current project a hell of a lot easier

Thanks again!

Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 10th Jul 2003 23:04 Edited at: 10th Jul 2003 23:14
if you`re sure on that IanM then I must take another look, I thought they where more messed up than that, sorry if I misled you Scraggle, I was sure they had way more problems , glad to hear they will be fully cured by p5 tho

Mentor.

Login to post a reply

Server time is: 2024-09-20 15:39:58
Your offset time is: 2024-09-20 15:39:58