mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   PARI/GP (https://www.mersenneforum.org/forumdisplay.php?f=155)
-   -   PARI's commands (https://www.mersenneforum.org/showthread.php?t=13636)

science_man_88 2010-11-30 19:22

[CODE]RLE(string)={
my(number=1,string=eval(Vec(Str(string))),Letter=string[1]);
for(x=2,#string,
if(string[x]==Letter,
number+=1,
print1("("number")"Letter);
Letter=string[x];
number=1)
);print1("("number")"Letter)
}[/CODE]


so it now becomes this and should work.

[QUOTE](1)m(1)i(2)s(1)i(2)s(1)i(2)p(1)i[/QUOTE]

science_man_88 2010-11-30 20:40

[QUOTE=science_man_88;239381]copying your format I found another missed semi colon[/QUOTE]

no the semi coon is the only thing I think lol.

science_man_88 2010-11-30 22:52

[QUOTE=science_man_88;239384][CODE]RLE(string)={
my(number=1,string=eval(Vec(Str(string))),Letter=string[1]);
for(x=2,#string,
if(string[x]==Letter,
number+=1,
print1("("number")"Letter);
Letter=string[x];
number=1)
);print1("("number")"Letter)
}[/CODE]


so it now becomes this and should work.[/QUOTE]

now I need a decoding part this semi falls under finding if a string is numerical, I'll start to try to decode it again.

science_man_88 2010-12-01 00:06

[url]http://rosettacode.org/wiki/Substring[/url]

too hard ? wasn't this done on this forum for FaR lol

CRGreathouse 2010-12-01 14:29

[QUOTE=science_man_88;239343]I added my() in just to satisfy you even though i see no point of it.[/QUOTE]

I thought you'd like this (maybe it'll make you feel better?) -- see #4:
[url]http://www.techradar.com/news/software/applications/10-mistakes-every-programmer-makes-909424[/url]

science_man_88 2010-12-01 15:09

[QUOTE=CRGreathouse;239468]I thought you'd like this (maybe it'll make you feel better?) -- see #4:
[url]http://www.techradar.com/news/software/applications/10-mistakes-every-programmer-makes-909424[/url][/QUOTE]

how does my help that ? nevermind I see what you mean lol.

science_man_88 2010-12-01 15:19

Suppressing exceptions:

never played with try and catch so never caught an error in my code to suppress lol.

science_man_88 2010-12-01 15:20

Storing secrets in plain text

good luck i don't even make addhelp for most of my programs in Pari lol, I'm not necessarily going to leave something as a comment lol.

science_man_88 2010-12-01 15:23

Not being up to date:

probably my second worst one.

my number 1 might be #1 lol

CRGreathouse 2010-12-01 15:37

[QUOTE=science_man_88;239474]Suppressing exceptions:

never played with try and catch so never caught an error in my code to suppress lol.[/QUOTE]

Yes, by doing nothing you have actually been doing it the right way. :smile:

Having said that, trap() is occasionally useful.

science_man_88 2010-12-01 15:53

[QUOTE=CRGreathouse;239477]Yes, by doing nothing you have actually been doing it the right way. :smile:

Having said that, trap() is occasionally useful.[/QUOTE]

Yeah same with comment(s) like they say [COLOR="Red"]no passwords in plain text[/COLOR] you may get lost trying to read uncommented code, But some random other person could have just as hard of a time until they figure it out.


All times are UTC. The time now is 23:10.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.