From: Eric Merritt <cyberlync@yahoo.com>
To: comp.lang.ada@ada.eu.org
Subject: Re: List container strawman 1.1
Date: Fri, 2 Nov 2001 13:45:29 -0800 (PST)
Date: 2001-11-02T13:45:29-08:00 [thread overview]
Message-ID: <mailman.1004737572.17072.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: <3BE301D1.4010106@telepath.com>
Not to rain on the discussion but I have to say that
the use of the "+" instead of Constructor is not very
intuitive. Someone suggested Make and Construct
wouldn't be bad, but I think "+" lacks readability and
could be confusing.
--- Ted Dennison <dennison@telepath.com> wrote:
> I have a new version of the strawman up at my
> website at
>
http://www.telepath.com/dennison/Ted/Containers-Lists-Unbounded.ads.html
>
> . This version has the cascading style sheet too, so
> hopefully nearly
> everyone should be able to read it.
>
> I tried to incorporate all of today's comments that
> don't require
> further discussion. If you made a comment that isn't
> incorporated, it
> either means that I think it need more discussion,
> or I forgot (sorry,
> it happens). If I missing something, please point it
> out.
>
> I'm going to make one more attempt to attach it as
> text and not HTML. It
> may look a bit ugly due to some lines being longer
> than 60 characters.
>
>
> with Ada.Finalization;
> with Ada.Streams;
>
>
-------------------------------------------------------------------------------
> -- This file contains a proposal for a standard Ada
> list package.
> --
> -- version - Strawman 1.1
>
-------------------------------------------------------------------------------
> generic
> type Element is private;
> package Containers.Lists.Unbounded is
>
>
>
-----------------------------------------------------------------------------
> -- The list type. I know the name's a bit
> redundant, but it doesn't
> look too
> -- bad, and any fully-named use will have to
> have a different name
> for the
> -- package anyway.
>
>
-----------------------------------------------------------------------------
> type List is private;
>
>
>
-----------------------------------------------------------------------------
> -- List construction operations. The returned
> list will contain
> *copies* of
> -- all the elements in the source lists, so
> these routines could get
> -- time-consuming. However, they should be
> useful for Lisp-like
> processing.
> --
> -- I'm trying out using unary plus ("+") for the
> "Construct"
> routine, but
> -- that's not a common idiom right now.
>
>
-----------------------------------------------------------------------------
> function "&" (Left, Right : Element) return
> List;
> function "&" (Left : Element; Right : List)
> return List;
> function "&" (Left : List; Right : Element)
> return List;
> function "&" (Left, Right : List) return List;
> function "+" (Initial_Element : Element) return
> List;
>
>
>
-----------------------------------------------------------------------------
> -- "push" and "pop" operations. Pops on empty
> lists raise No_Item.
>
>
-----------------------------------------------------------------------------
> No_Item : exception;
>
> procedure Push_Front (Target : in out List;
> New_Element : in
> Element);
> procedure Pop_Front (Target : in out List;
> Old_Element : out
> Element);
> procedure Push_Back (Target : in out List;
> New_Element : in
> Element);
> procedure Pop_Back (Target : in out List;
> Old_Element : out
> Element);
>
>
>
-----------------------------------------------------------------------------
> -- Non-modifying query operations.
>
>
-----------------------------------------------------------------------------
> function Is_Empty (Subject : List) return
> Boolean;
> function Size (Subject : List) return
> Natural;
> function Front (Subject : List) return
> Element;
> function Back (Subject : List) return
> Element;
>
>
>
-----------------------------------------------------------------------------
> -- Passive iterator. Operation will be applied
> on each element on
> the list
> -- Opertion can terminate this process early by
> setting Quit to True.
>
>
-----------------------------------------------------------------------------
> generic
> with procedure Operation (Target : in out
> Element; Quit : out
> Boolean);
> procedure Passive_Iterator (Target : in out
> List);
>
>
>
-----------------------------------------------------------------------------
> -- Iteration routines. For an empty list, First
> = Done_Iterating.
> Item and
> -- Remove raise No_Item if they are called with
> a value of
> Done_Iterating.
> -- As written, a typical iteration idiom would
> look like:
> --
> -- i := My_Lists.First (My_List);
> -- while i /= My_Lists.Done_Iterating loop
> -- do stuff with My_Lists.Item(i);
> -- i := My_Lists.Next (i);
> -- end loop;
> --
> -- Another alternative using "Size" would be:
> --
> -- i := My_Lists.First (My_List);
> -- for iteration_count in 1..My_Lists.Size
> (My_List) loop
> -- do stuff with My_Lists.Item (i);
> -- i := My_Lists.Next (i);
> -- end loop;
> --
>
>
-----------------------------------------------------------------------------
> type Iterator is private;
> Done_Iterating : constant Iterator;
>
> function First (Subject : List) return
> Iterator;
> function Last (Subject : List) return
> Iterator;
> function Next (Location : Iterator) return
> Iterator;
> function Previous (Location : Iterator) return
> Iterator;
> function Item (Location : Iterator) return
> Element;
>
> -- Ideally these routines would verify that
> Location was issued for
> the Subject
> -- list and is still valid, but that would be
> tough to enforce.
> Better to call
> -- such misuse a "bounded error", or somesuch.
>
>
-----------------------------------------------------------------------------
> -- Remove the element at the given location, and
> advance Location to
> the next
> -- element.
> -- If Location=Done_Iterating then No_Item will
> be raised.
> -- If Location=First, then Location will be set
> to the new First.
> -- If Location=Last, then Location will be set
> to Done_Iterating.
> -- otherwise, Location will be set to what Next
> was previously (the next
> -- element after the removal).
>
>
-----------------------------------------------------------------------------
> procedure Remove (Subject : in out List;
> Location : in out Iterator);
>
>
>
-----------------------------------------------------------------------------
> -- Insert the given element at the given
> location in the list (in
> front of
>
=== message truncated ===
__________________________________________________
Do You Yahoo!?
Find a job, post your resume.
http://careers.yahoo.com
next prev parent reply other threads:[~2001-11-02 21:45 UTC|newest]
Thread overview: 90+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-02 20:29 List container strawman 1.1 Ted Dennison
2001-11-02 21:00 ` Larry Kilgallen
2001-11-02 21:08 ` Ted Dennison
2001-11-02 21:43 ` Larry Kilgallen
2001-11-02 21:20 ` Darren New
2001-11-02 23:33 ` Jeffrey Carter
2001-11-03 0:19 ` Darren New
2001-11-03 7:03 ` Ted Dennison
2001-11-02 21:45 ` Eric Merritt [this message]
2001-11-02 22:52 ` Larry Kilgallen
2001-11-03 7:09 ` Ted Dennison
2001-11-04 0:30 ` Nick Roberts
2001-11-05 12:40 ` Eric Merritt
2001-11-05 22:26 ` Nick Roberts
2001-11-05 23:28 ` Eric Merritt
2001-11-06 16:42 ` Nick Roberts
2001-11-06 17:24 ` Stephen Leake
2001-11-06 18:28 ` Eric Merritt
2001-11-06 22:17 ` Nick Roberts
2001-11-07 19:31 ` Stephen Leake
2001-11-07 22:55 ` Nick Roberts
2001-11-10 3:17 ` Ted Dennison
2001-11-10 3:31 ` Darren New
2001-11-13 16:47 ` Stephen Leake
2001-11-13 17:21 ` Darren New
2001-11-13 20:36 ` Ted Dennison
2001-11-13 23:48 ` Ben Place
2001-11-14 4:01 ` Nick Roberts
2001-11-14 16:10 ` Jeffrey Carter
2001-11-14 19:12 ` Ted Dennison
2001-11-14 22:32 ` Jeffrey Carter
[not found] ` <_mzI7.24675 <3BF2F0E7.5DD40B4B@boeing.com>
2001-11-15 3:49 ` Nick Roberts
2001-11-10 3:07 ` Ted Dennison
2001-11-10 14:18 ` Florian Weimer
2001-11-13 16:48 ` Stephen Leake
2001-11-06 18:21 ` Eric Merritt
2001-11-08 11:53 ` Simon Wright
2001-11-06 16:30 ` Darren New
2001-11-06 18:19 ` Eric Merritt
2001-11-04 4:55 ` Larry Hazel
[not found] ` <3BE31DD5.FF96AFE0@san.rr.com>
2001-11-03 7:07 ` Ted Dennison
2001-11-03 18:59 ` Jeffrey Carter
2001-11-04 19:07 ` Darren New
2001-11-04 22:21 ` Jeffrey Carter
2001-11-04 23:43 ` James Rogers
2001-11-05 18:09 ` Darren New
2001-11-05 22:59 ` Jeffrey Carter
2001-11-04 20:56 ` Jean-Marc Bourguet
2001-11-05 20:00 ` Ted Dennison
2001-11-05 20:27 ` Darren New
2001-11-05 20:54 ` Ted Dennison
2001-11-05 22:30 ` Darren New
2001-11-08 10:50 ` Ehud Lamm
2001-11-05 9:53 ` Mike Ovenden
2001-11-05 14:37 ` Jean-Marc Bourguet
2001-11-05 20:03 ` Ted Dennison
2001-11-06 8:52 ` Jean-Marc Bourguet
2001-11-05 16:01 ` Marin David Condic
2001-11-05 20:06 ` Ted Dennison
2001-11-05 20:45 ` Marin David Condic
2001-11-08 10:54 ` Ehud Lamm
2001-11-08 19:30 ` Marin David Condic
2001-11-08 22:06 ` Nick Roberts
2001-11-10 18:15 ` Simon Wright
2001-11-11 21:33 ` Pascal Obry
2001-11-11 21:55 ` Ehud Lamm
2001-11-05 22:37 ` Nick Roberts
2001-11-09 15:51 ` Ted Dennison
2001-11-10 0:47 ` Nick Roberts
2001-11-06 12:38 ` Roy Bell
2001-11-08 10:56 ` Ehud Lamm
2001-11-08 18:08 ` Roy Bell
2001-11-09 15:55 ` Ted Dennison
2001-11-09 16:15 ` Ehud Lamm
2001-11-09 17:37 ` Marin David Condic
2001-11-09 22:24 ` Ehud Lamm
2001-11-11 15:39 ` Marin David Condic
2001-11-10 2:35 ` Ted Dennison
2001-11-10 4:03 ` Jeffrey Carter
2001-11-11 21:09 ` Simon Wright
2001-11-12 5:33 ` Ted Dennison
2001-11-12 16:13 ` Jeffrey Carter
2001-11-13 7:11 ` Simon Wright
2001-11-11 15:45 ` Marin David Condic
2001-11-11 21:03 ` Simon Wright
2001-11-11 21:57 ` Ehud Lamm
2001-11-12 15:24 ` Marin David Condic
2001-11-13 7:06 ` Simon Wright
2001-11-13 21:21 ` Marin David Condic
2001-11-13 16:55 ` Stephen Leake
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox