comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison <dennison@telepath.com>
Subject: Re: Thoughts on the recent ICFP contest
Date: Thu, 12 Sep 2002 16:32:37 GMT
Date: 2002-09-12T16:32:37+00:00	[thread overview]
Message-ID: <3D80C1B1.5070703@telepath.com> (raw)
In-Reply-To: tBTf9.396604$me6.45556@sccrnsc01

tmoran@acm.org wrote:
>> (3) A generic implementation of Dijkstra's Algorithm
> 
> In the sense of an Ada "generic", or what?  I would think a library

Not in the Ada sense, no. But it could be made an Ada generic I suppose, 
to allow user-defined data in the graph nodes.

> version of the algorithm would be a single call, taking a graph
> representation as input and giving a shortest path as output,
> so the only novelty would be in devising convenient ways to build
> the input data structure or use the output.  Or is this not what
> you're think of at all?

Well, I believe that algorithm finds *all* shortest paths from a given 
node as a side effect. Given that, one might want to have one call to 
find all the paths, then another to return the shortest one between two 
given nodes. As long as the start node is on the original path, you 
wouldn't need to recalculate.

Then again, if one wanted to make some kind of general path search 
interface, keeping it simple enough to be supported by any algorithm 
might be better.

But again, I'm not sure how generally useful this would be. I've never 
needed such a thing at work. But then again there are many industries 
I've never worked in...

>>stream, with the various sockopt function codes implemented as
>>primitives on it.  I'm curious if anyone else thinks something like this
> 
>   Can you give an example of a piece of code written using what you
> have in mind?

The idea is that network code would look just like file streaming code. 
Something along the lines of:

    Ada.Streams.Sockets.Connect
       (New_Socket => Server,
        Address    => (127,0,0,1),
        Port       => 5517,
        Protocol   => Ada.Streams.Sockets.TCP);
    Server_Request'Write (Server, Request);
    Server_Response'Read (Server, Response);


> 
>>to transmit an entire buffer at once, rather than one component at a
> 
>   Like marshalling all those 'Writes to a buffer, then making one
> socket'write(buffer) call?
> 
> 
>>Since this is a speed optimization, copying the buffer would be missing
>>the point.
> 
>   That sounds more like creating a "channel program" to do "gather
> writes" when the IO is actually started.  Is that what you mean?

No, nothing that complicated (unless I'm misunderstanding you). Its just 
that 'Write on a 1000-byte array will, by default, perform one 'Write on 
  each component of that array, amounting to 1000 'Writes. That means 
any time someone is interested in efficency, they end up having to make 
their own 'Write that calls Ada.Streams.Write once for each object that 
they want transferred efficiently. This is an issue for *any* stream, 
not just the one I'm proposing above.

It would be nice if instead there were a generic object that already has 
this overload for its 'Write and 'Read, and to which any object can be 
converted. No actual data would have to be copied to do this.




  parent reply	other threads:[~2002-09-12 16:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-12  2:35 Thoughts on the recent ICFP contest Ted Dennison
2002-09-12  3:11 ` tmoran
2002-09-12 14:23   ` Wes Groleau
2002-09-12 16:43     ` Ted Dennison
2002-09-12 16:53     ` David C. Hoos
2002-09-16 20:41       ` Wes Groleau
2002-09-17  3:21         ` Ted Dennison
2002-09-12 19:15     ` tmoran
2002-09-12 16:32   ` Ted Dennison [this message]
2002-09-12 19:15     ` tmoran
2002-09-13  1:45       ` Ted Dennison
2002-09-13 15:46       ` Warren W. Gay VE3WWG
2002-09-17 10:36 ` Jacob Sparre Andersen
2002-09-17 12:55   ` Ted Dennison
2002-09-17 14:41     ` Jacob Sparre Andersen
2002-09-17 10:56 ` Preben Randhol
2002-09-17 12:38   ` Ted Dennison
2002-09-18  0:31     ` tmoran
2002-09-18  7:15     ` Samuel Tardieu
replies disabled

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