comp.lang.ada
 help / color / mirror / Atom feed
From: "chris.danx" <spamoff.danx@ntlworld.com>
Subject: Re: Neat and tidy solution to following problem?
Date: Tue, 7 May 2002 21:56:21 +0100
Date: 2002-05-07T21:56:21+01:00	[thread overview]
Message-ID: <UfXB8.3058$0h6.132145@newsfep1-win.server.ntli.net> (raw)
In-Reply-To: 3CD83B55.75FC2B01@easystreet.com


<achrist@easystreet.com> wrote in message
news:3CD83B55.75FC2B01@easystreet.com...
> "chris.danx" wrote:
> >
> > I'm just wondering if there's a way to have something similar in Ada
> > 95 like have two items returned from a function but not have to
> > declare an explicit type.
> >
>
> You would do this in Ada as a procedure (not a function) with multiple
> in out parameters.

That's one of two solutions that spring immediately to mind (in fact it's
how I've implemented it, and would usually do so).

> I'd be interested to know how well recursion in Ada substitutes for
> looping (efficiency-wise).  Some of the functional languages are not
> really high performance, and it would be interesting to see if you could
> get about the same level of performance from the same style of coding
> using a procedural language.

It seems the techniques in compiler construction for procedural/imperative
languages are well studied and understood but for functional languages the
situation is different.  We just haven't gotten clever enough to compile
functional languages to similarly efficient code.  :)


> In your example, for example, our spec  might say that words are
> never very long (say more than 50 characters or so), so we
> wouldn't have to worry about problems with very deep recursions.

In this case the length of the strings per line in the file is left
unspecified, and also the size of the document.  If it's large then there'd
probably be a problem with a recursive solution unless the recursion
operates in more or less constant space (can't remember what this is called,
but iirc it's doable for a variety of problems).

Chris







  reply	other threads:[~2002-05-07 20:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-07 18:24 Neat and tidy solution to following problem? chris.danx
2002-05-07 19:17 ` Preben Randhol
2002-05-07 20:21   ` chris.danx
2002-05-08  1:11     ` Jeffrey Carter
2002-05-08  8:16       ` Danx
2002-05-07 20:38 ` achrist
2002-05-07 20:56   ` chris.danx [this message]
2002-05-25 20:56     ` Robert I. Eachus
replies disabled

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