Re: String filtering
- From: David Trudgett <wpower@xxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 28 Sep 2005 11:01:43 +1000
Jacob Sparre Andersen <sparre@xxxxxx> writes:
> David Trudgett wrote:
>> Dmitry A. Kazakov wrote:
>>> On Tue, 27 Sep 2005 19:13:17 +1000, David Trudgett wrote:
>
>>>> New_Str : Unbounded_String
>>>> := To_Unbounded_String(Count(Str, Alphanumeric_Set));
>>>
>>> If you do this, then use String (1..Count (...));
>>
>> If I did that then I would need to convert back to unbounded_string
>> when I return the function result. Would that be significantly
>> faster than working on a pre-allocated unbounded string?
>
> I think it would, but it clearly depends on the implementation of
> Ada.Strings.Unbounded.
You may be right about that, but there is probably irreducible
complexity in unbounded strings. For my particular current purposes,
there is nothing between them performance-wise.
>
>>> Either, you need a character *stream* filtering,
>>
>> Possibly, but I'm not using a socket stream interface at the current
>> time. The socket library I'm using right now doesn't do streams.
>
> It definitely looks like an ideal example for the use of streams. Is
> there something that makes it a bad idea to switch to a stream-capable
> socket package?
Only the fact that I'm just toying with a game program, and the socket
library already works (adasockets 0.1.6 IIRC), and the comms layer I
wrote works on top of it. Changing it in future won't be any big deal,
however, since it's abstracted away behind my comms layer.
> You should use the programming styles supported by Ada, when you're
> programming in Ada.
Yes, indeed.
> Otherwise it may be very frustrating to program in Ada. For
> functional programming you should use SML, Erlang, OCaml or another
> "proper" functional programming language.
Well, I don't do pure "functional" as some people define it. I only
tend in that direction where I find it helpful. Ada is very much
procedural, however.
David
--
David Trudgett
http://www.zeta.org.au/~wpower/
No one is given a map to their dreams
All we can do is to trace it.
See where we go to, know where we've been
Build up the courage to face it.
-- Sandy Denny
.
- Follow-Ups:
- Re: String filtering
- From: David Trudgett
- Re: String filtering
- References:
- String filtering
- From: David Trudgett
- Re: String filtering
- From: David Trudgett
- Re: String filtering
- From: David Trudgett
- Re: String filtering
- From: Jacob Sparre Andersen
- String filtering
- Prev by Date: Re: String filtering
- Next by Date: Re: String filtering
- Previous by thread: Re: String filtering
- Next by thread: Re: String filtering
- Index(es):
Relevant Pages
|