Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.lisp
> understanding: If you want to make a string longer by inserting
William James
9/2/2015 4:07:00 PM
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/z...
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
> understanding: If you want to make a string longer by inserting
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password