comp.lang.ada
 help / color / mirror / Atom feed
* Lists within Lists or Nested Linked Lists...
@ 2004-03-07  4:13 Coder87c
  2004-03-07 11:32 ` Marius Amado Alves
  0 siblings, 1 reply; 4+ messages in thread
From: Coder87c @ 2004-03-07  4:13 UTC (permalink / raw)


Hello everyone, i been a Ada programmer in college for about 8 months
now.

Right now we are doing Lists within Lists or Nested Linked Lists I
cant decided which name is right.

Dont worry I wont be asking for anyone to do my work for me, Im just
tottaly baffled.

So I got something like this...

TYPE TaskNode;
   TYPE TNodePtr IS ACCESS TaskNode;
   TYPE TNode IS RECORD
      Name             : Positive;
      Work             : Natural;
      Worked           : Natural;
      Next             : TNodePtr;
   END RECORD;

   TYPE PNode;
   TYPE Scheduler IS ACCESS PNode;
   SUBTYPE PNodePtr IS Scheduler;
   TYPE PNode IS RECORD
      Number           : Positive;
      TDone            : Natural;
      TLeft            : Natural;
      head             : TNodePtr;
      tail             : TNodePtr;
      Next             : PNodePtr;
   END RECORD;


So basically if the program was complete the user could assign a
number like

1 and have its Tdone be 5 and Tleft be 4

Then the user could assign another number like 

5 and have its Tdone be 3 and Tleft be 10

It cant keep creating diffrent Numbers and assigned it Tdones and
Tlefts.

It can also take awwy Tdones..

Now my problem is... How do I simply assign start?  

Like how would a function look like just to assign a number to number?
 With no Tdones or Tlefts?

Right now I got something like this

  A := new Pnode'(Number,0,0,NULL,NULL,NULL);

but this assigns Pnode to something and when I recall it just erases A
and replaces it with the new thing.

Sorry if this is unclear.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Lists within Lists or Nested Linked Lists...
  2004-03-07  4:13 Lists within Lists or Nested Linked Lists Coder87c
@ 2004-03-07 11:32 ` Marius Amado Alves
  2004-03-10 19:10   ` Matthew Heaney
  0 siblings, 1 reply; 4+ messages in thread
From: Marius Amado Alves @ 2004-03-07 11:32 UTC (permalink / raw)
  To: comp.lang.ada

On Sunday 07 March 2004 04:13, Coder87c wrote:
> Right now we are doing Lists within Lists or Nested Linked Lists I
> cant decided which name is right.

Lists_Of_Lists ?

> TYPE TaskNode;
>    TYPE TNodePtr IS ACCESS TaskNode;
>    TYPE TNode IS RECORD
>       Name             : Positive;
>       Work             : Natural;
>       Worked           : Natural;
>       Next             : TNodePtr;
>    END RECORD;

Why TaskNode *and* TNode? Why not just TaskNode? And the indentation is wrong.

>    TYPE PNode;
>    TYPE Scheduler IS ACCESS PNode;
>    SUBTYPE PNodePtr IS Scheduler;
>    TYPE PNode IS RECORD
>       Number           : Positive;
>       TDone            : Natural;
>       TLeft            : Natural;
>       head             : TNodePtr;
>       tail             : TNodePtr;
>       Next             : PNodePtr;
>    END RECORD;
>
>
> So basically if the program was complete the user could assign a
> number like
>
> 1 and have its Tdone be 5 and Tleft be 4

You mean create a PNode object with the specified values for Number, TDone 
and TLeft? Write a constructor function...

> ...
> It can also take awwy Tdones..

and list operations.

> Now my problem is... How do I simply assign start?

Assign what to what?

> Like how would a function look like just to assign a number to number?
>  With no Tdones or Tlefts?

Write specialised constructor and/or update operations.

> Sorry if this is unclear.

Yes, please try to be more rigourous and write better Ada style.

Also, an English (but correct) description of the ADT you want to write might 
assist both yourself and us. Remember an ADT is essentially a set of 
operations. The auxiliary types and components follow. Think topdown.

If the focus of this homework is scheduling and not lists consider using an 
existing, tried and true, list library, e.g. Charles. Even if the focus is 
lists, studying the source code of such a library would help. However if you 
have not learnt generics yet, and don't want to just now, forget this last 
advice.

(It's always nice to see homework efforts on CLA. It's a sign Ada is being 
taught. However--and this may be the paranoid in me--I tend to interpret some 
details as weaknesses of the instruction side. For example, the style. If 
someone is in a condition to ease my mind, please do. For what it matters, 
I've been an Ada instructor myself.)



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Lists within Lists or Nested Linked Lists...
  2004-03-07 11:32 ` Marius Amado Alves
@ 2004-03-10 19:10   ` Matthew Heaney
  2004-03-15 15:58     ` Matthew Heaney
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Heaney @ 2004-03-10 19:10 UTC (permalink / raw)


Marius Amado Alves <amado.alves@netcabo.pt> wrote in message news:<mailman.71.1078658896.327.comp.lang.ada@ada-france.org>...
> 
> If the focus of this homework is scheduling and not lists consider using an 
> existing, tried and true, list library, e.g. Charles. Even if the focus is 
> lists, studying the source code of such a library would help. However if you 
> have not learnt generics yet, and don't want to just now, forget this last 
> advice.

Charles is moving to tigris.org.  The new URL is:

<http://charles.tigris.org/>

I have just recently posted the latest release of the doubly-linked
lists.  The singly-linked lists will be done in a day or two.

-Matt



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Lists within Lists or Nested Linked Lists...
  2004-03-10 19:10   ` Matthew Heaney
@ 2004-03-15 15:58     ` Matthew Heaney
  0 siblings, 0 replies; 4+ messages in thread
From: Matthew Heaney @ 2004-03-15 15:58 UTC (permalink / raw)


mheaney@on2.com (Matthew Heaney) wrote in message news:<1ec946d1.0403101110.7b214b0d@posting.google.com>...
> 
> I have just recently posted the latest release of the doubly-linked
> lists.  The singly-linked lists will be done in a day or two.

I have posted the singly- and doubly-linked list containers.  There
are both bounded and unbounded forms for each.

<http://charles.tigris.org/source/browse/charles/src/>

-Matt



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-03-15 15:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-07  4:13 Lists within Lists or Nested Linked Lists Coder87c
2004-03-07 11:32 ` Marius Amado Alves
2004-03-10 19:10   ` Matthew Heaney
2004-03-15 15:58     ` Matthew Heaney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox