For Programmers: Free Programming Magazines  


Home > Archive > Scheme > November 2007 > A vague notion about STRING









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author A vague notion about STRING
Joo ChurlSoo

2007-11-27, 4:33 am


I occasionly have a vague notion that if all strings were defined as vectors
terminated by the null-character as all lists are defined as pairs that are
terminated by the empty list, many string-manipulated procedures could be
defined more efficiently without using the STRING-LENGHT procedure explicitly
(or implicitly).
How about this wanton thought?

--
Joo ChurlSoo
Shiro Kawai

2007-11-28, 10:13 pm

Joo ChurlSoo<i...@initerm.com> wrote:
> I occasionly have a vague notion that if all strings were defined as vectors
> terminated by the null-character as all lists are defined as pairs that are
> terminated by the empty list, many string-manipulated procedures could be
> defined more efficiently without using the STRING-LENGHT procedure explicitly
> (or implicitly).
> How about this wanton thought?


You'd need a special object which can't be a valid character to mark
the end of
strings, or you won't be able to handle strings that contain NUL-
characters
in it.

Whether it can be efficient or not depends, though. I suspect your
idea only
solves a small part of the problem. For example, it may not be very
good at
substring sharing, and won't help to improve fast concatenation; both
are
very frequent operation on strings, I think.

I'd rather like to make a string an opaque object which I can treat it
as
if a list of characters (as in Haskell), relatively fast indexing
(O(1) is
ideal, but O(log n) is OK), and fast concatenation.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com