Re: limited types (Was: Records that could be arrays)




Dmitry A. Kazakov wrote:

1. Passing as a parameter

Just pass a cursor:

procedure Op (C : in out Container_Type) is
begin
Do_Something (C.First);
...
end;

You know you've run out of elements when Has_Element returns False.


2. Copying

while (Has_Element (C) loop
Put_Element_Somewhere (Element (C);
end loop;

3. Merging

You'll need to define a relational operator over your element type, but
then you can say:

Merge (C1.First, C2.First);


4. Slicing

Just use a cursor pair:

Do_Something (C1, C2); -- half-open range


5. Closures and simultaneous traversal of two or more containers

Do_Something (C1, C2);


6. Relational operations on sets of containers

Compare (C1, C2);


If you don't understand this, go to

http://charles.tigris.org

and browse the Charles.Algorithms subsystem. (Things are a little
different for the Ada 2005 container library, but it should give you
the general idea.)

.



Relevant Pages

  • RE: Oracle cursor help
    ... rids dbms_utility.uncl_array; ... where <your where clause> ... Subject: Re: Oracle cursor help ... exit the loop: */ ...
    (perl.dbi.users)
  • Command object stops prematurely without error?
    ... However, when run via the ADO Command object, the outer loop Applications ... Declare cApps CURSOR for Select ApplicationID from UCM_Applications ...
    (microsoft.public.data.ado)
  • Re: Calling a SP inside a cursor loop..
    ... every loop iteration of the cursor. ... Fetch next From EffectiveDate_Cursor Into @FLD1,@FLD2 ... and If the Fetch stmt is below the begin Stmt, the loop iterations are ... the proper way to program a cursor loop is: ...
    (comp.databases.ms-sqlserver)
  • Re: Decouple SQL queries from class in OOP design
    ... > Dmitry A. Kazakov wrote: ... >> Not only the cursor but DB as a whole is a subject of abstraction. ... > as Prolog, and much more sucessful than Prolog. ...
    (comp.object)
  • Re: => Trigger to split Trailer Loads
    ... I am using a Trigger and a cursor with a while loop, however the recursive behaviour of the cursor is causing me ... I can successfully copy an order from tblOrders to tblSplitOrders, duplicating order details and splitting the load into ... Enters LineSplit>0 ...
    (microsoft.public.sqlserver.mseq)