librelist archives

« back to archive

Shall STRINGs be a COLLECTION[CHARACTER]

Shall STRINGs be a COLLECTION[CHARACTER]

From:
Paolo Redaelli
Date:
2011-09-21 @ 06:09
While I was studying string hierarchy implementing the arg query I 
discovered that mutable strings don't inherit from COLLECTION[CHARACTER].
Quite correctly ABSTRACT_STRING does not since it should not have 
changing commands so it only inherit from TRAVERSABLE[CHARACTER] and 
SEARCHABLE[CHARACTER].
Shouldn't "mutable" strings inherit COLLECTION[CHARACTER] ?
I know that many features are duplicated with different names and 
different implementations, but - at least theoretically - a string *is* 
a collection of characters.
I'm wondering if we shall have a common ancestror of all mutable strings 
which inherit from collection.....

     Paolo - thinkering about it when implementing arg and infix "#"

PS: I almost finished arg when I discovered that it saves an explicit 
allocation of a manifest array allocating **TWO** array each time arg is 
called on a STRING... nice isn't it :)

Re: [libertyeiffel] Shall STRINGs be a COLLECTION[CHARACTER]

From:
Cyril Adrian
Date:
2011-09-22 @ 12:21
Hi Paolo,

2011/9/21 Paolo Redaelli <paolo.redaelli@gmail.com>

> While I was studying string hierarchy implementing the arg query I
> discovered that mutable strings don't inherit from COLLECTION[CHARACTER].
> Quite correctly ABSTRACT_STRING does not since it should not have
> changing commands so it only inherit from TRAVERSABLE[CHARACTER] and
> SEARCHABLE[CHARACTER].
> Shouldn't "mutable" strings inherit COLLECTION[CHARACTER] ?
> I know that many features are duplicated with different names and
> different implementations, but - at least theoretically - a string *is*
> a collection of characters.
>

Yes, you are right.


> I'm wondering if we shall have a common ancestror of all mutable strings
> which inherit from collection.....
>

One thing leading to another, what happens if you insert a character in the
middle of a STRING held by a ROPE? … answering to myself: nothing bad since
the split index is not an attribute anymore…

    Paolo - thinkering about it when implementing arg and infix "#"
>
> PS: I almost finished arg when I discovered that it saves an explicit
> allocation of a manifest array allocating **TWO** array each time arg is
> called on a STRING... nice isn't it :)
>

I'm not sure to have understood :-( Do you have an example?

Cheers,

*Cyril ADRIAN
**(from office)*
Share with me: [image: Twitter] <http://www.twitter.com/cadbart> [image:
LinkedIn] <http://fr.linkedin.com/in/cadrian> [image: Google

Calendar]<https://www.google.com/calendar/embed?src=1t93vvvrdc26ee0f83p0cunj60%40group.calendar.google.com&ctz=Europe/Paris>
[image:
Google Plus] <https://plus.google.com/100388810006463519079>
Contact me: [image: Google Talk] cyril.adrian@gmail.com
[image: My QR VCard]


 Signature by WiseStamp.

<http://r1.wisestamp.com/r/landing?promo=15&dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_15>
Get
it 
now!<http://r1.wisestamp.com/r/landing?promo=15&dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_15>

Re: [libertyeiffel] Shall STRINGs be a COLLECTION[CHARACTER]

From:
Paolo Redaelli
Date:
2011-09-22 @ 16:43
Il 22/09/2011 14:21, Cyril ADRIAN ha scritto:
> Yes, you are right.
Let's put on the wishlist.... :)
>
>     I'm wondering if we shall have a common ancestror of all mutable
>     strings
>     which inherit from collection.....
>
>
> One thing leading to another, what happens if you insert a character 
> in the middle of a STRING held by a ROPE? … answering to myself: 
> nothing bad since the split index is not an attribute anymore…
It was exactly the usage I had in mind..... :)
It still has some issues, mainly on my own. Real ropes - the one 
described in Wikipedia are somehow balanced trees. Current ROPE is all 
but balanced, actually they end up looking like a linked list.....
>
>         Paolo - thinkering about it when implementing arg and infix "#"
>
>     PS: I almost finished arg when I discovered that it saves an explicit
>     allocation of a manifest array allocating **TWO** array each time
>     arg is
>     called on a STRING... nice isn't it :)
>
>
> I'm not sure to have understood :-( Do you have an example?
See 

https://github.com/tybor/Liberty/blob/master/src/lib/string/internal/fillable_string.e

... every tentative FILLABLE_STRING contains pieces, a 
LINKED_LIST[ABSTRACT_STRING] and placeholder_indexes, an 
ARRAY[INTEGER].... quite naive isn't it? :)


I'm solving it copying the automaton from message printer.... :)

Re: [libertyeiffel] Shall STRINGs be a COLLECTION[CHARACTER]

From:
Cyril Adrian
Date:
2011-09-23 @ 11:12
2011/9/22 Paolo Redaelli <paolo.redaelli@gmail.com>

> **
> Il 22/09/2011 14:21, Cyril ADRIAN ha scritto:
> It still has some issues, mainly on my own. Real ropes - the one described
> in Wikipedia are somehow balanced trees. Current ROPE is all but balanced,
> actually they end up looking like a linked list.....
>

You may want to look at AVL_TREE…

I'm solving it copying the automaton from message printer.... :)
>

It would be great to isolate the algorithm to be able to simply reuse it. I
thought that MESSAGE_FORMATTER could be reused (inserted?)

Cheers,

*Cyril ADRIAN
**(from office)*
Share with me: [image: Twitter] <http://www.twitter.com/cadbart> [image:
LinkedIn] <http://fr.linkedin.com/in/cadrian> [image: Google

Calendar]<https://www.google.com/calendar/embed?src=1t93vvvrdc26ee0f83p0cunj60%40group.calendar.google.com&ctz=Europe/Paris>
[image:
Google Plus] <https://plus.google.com/100388810006463519079>
Contact me: [image: Google Talk] cyril.adrian@gmail.com
 [image: Twitter] <http://twitter.com/cadbart> Latest tweet: [Liberty]
http://t.co/HVba0IX Cyril Adrian - useful option.
Follow @cadbart <http://twitter.com/cadbart> Reply

<http://twitter.com/?status=@cadbart%20&in_reply_to_status_id=106427146326654980&in_reply_to=cadbart>
Retweet

<http://twitter.com/?status=RT%20%40cadbart%3A%20%5BLiberty%5D%20http%3A%2F%2Ft.co%2FHVba0IX%20Cyril%20Adrian%20-%20useful%20option.>
 20:06 Aug-24<http://twitter.com/cadbart/statuses/106427146326654976>
  Get this email app!

<http://www.wisestamp.com/apps/twitter?utm_source=extension&utm_medium=email&utm_term=twitter&utm_campaign=apps>

 [image: Google Plus] <http://plus.google.com/100388810006463519079> My
latest G+: excellent !! Nicolas Perrier originally shared this post: Draw a
Stickman <http://plus.google.com/100388810006463519079/posts/c9ou3PS8dAC/>
My G+ <http://plus.google.com/100388810006463519079> -
Posts<http://plus.google.com/100388810006463519079/posts/>- Add
to Circles <http://plus.google.com/100388810006463519079/about/> - 15:23
Sep-22 <http://plus.google.com/100388810006463519079/about/>
  Get this email app!

<http://www.wisestamp.com/apps/plus?utm_source=extension&utm_medium=email&utm_term=plus&utm_campaign=apps>

[image: My QR VCard]


 Signature by WiseStamp.

<http://r1.wisestamp.com/r/landing?promo=15&dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_15>
Get
it 
now!<http://r1.wisestamp.com/r/landing?promo=15&dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_15>

Re: [libertyeiffel] Shall STRINGs be a COLLECTION[CHARACTER]

From:
Paolo Redaelli
Date:
2011-09-23 @ 12:05
Il 23/09/2011 13:12, Cyril ADRIAN ha scritto:
> 2011/9/22 Paolo Redaelli <paolo.redaelli@gmail.com 
> <mailto:paolo.redaelli@gmail.com>>
>
>     Il 22/09/2011 14:21, Cyril ADRIAN ha scritto:
>     It still has some issues, mainly on my own. Real ropes - the one
>     described in Wikipedia are somehow balanced trees. Current ROPE is
>     all but balanced, actually they end up looking like a linked
>     list.....
>
>
> You may want to look at AVL_TREE…
I've been thinking a little about it noticing that ropes are most often 
iterated on and used as pieces of other ropes; it seems to me that both 
these activities does not require or take benefit from rebalancing; 
iterating would save time while allocating more sub-ropes rope composing 
becomes potentially more costly in CPU time; so I would say that with 
current usage pattern we shall leave them as they are; perhaps a little 
notice in ROPE text would be useful.
>
>     I'm solving it copying the automaton from message printer.... :)
>
>
> It would be great to isolate the algorithm to be able to simply reuse 
> it. I thought that MESSAGE_FORMATTER could be reused (inserted?)
Actually not so easily since I changed it a little: MESSAGE_FORMATTER 
fills all the values it finds while ABSTRACT_STRING.arg only one.


 
 
 --
 Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP
autenticato? GRATIS solo con Email.it http://www.email.it/f
 
 Sponsor:
 Scopri i vantaggi del riconoscimento vocale e come convertire file Pdf su
nuanceforbusiness.com
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=11843&d=23-9