Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

> understanding: If you want to make a string longer by inserting

10 views
Skip to first unread message

WJ

unread,
Sep 2, 2015, 12:08:29 PM9/2/15
to
Why this is marked as abuse? It has been marked as abuse.
Report not abuse
Edi Weitz wrote:

> > understanding: If you want to make a string longer by inserting
> > stuff, this means you MUST cons up a new copy. This is a basic
> > understanding that holds for all computer languages. [...] Perl and
> > VB and the like will paper over this fact, but it still holds for
> > those languages aswell.
>
> Good point. In Perl, e.g., you can write stuff like this
>
> #!/usr/bin/perl -l
>
> $a = "abcdefghi";
> $b = "abcdefghi";
> $c = "abcdefghi";
> (substr $a, 3, 3) = "XXX";
> (substr $b, 2, 4) = "XXX";
> (substr $c, 4, 2) = "XXX";
> print $a;
> print $b;
> print $c;
>
> and expect a result that looks like so:
>
> edi@vmware:~$ perl /tmp/foo.pl
> abcXXXghi
> abXXXghi
> abcdXXXghi

MatzLisp (Ruby):

a = "foo 234 bar who"
a[ /\d+/ ] = "NUMBER_CONCEALED"
a
===>
"foo NUMBER_CONCEALED bar who"

--
For two years ... he was held in solitary confinement in the Toronto West
Detention Centre, on the pretext that he is a threat to national security....
[A] court in Mannheim sentenced him to five years imprisonment for the crime of
"popular incitement" under Germany's notorious "Holocaust denial" statute.
http://www.revisionists.com/revisionists/zundel.html
0 new messages