mersenneforum.org  

Go Back   mersenneforum.org > Math Stuff > Computer Science & Computational Number Theory > PARI/GP

Reply
 
Thread Tools
Old 2010-11-30, 19:22   #1838
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

203008 Posts
Default

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)
}

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

Last fiddled with by science_man_88 on 2010-11-30 at 19:25
science_man_88 is offline   Reply With Quote
Old 2010-11-30, 20:40   #1839
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
copying your format I found another missed semi colon
no the semi coon is the only thing I think lol.
science_man_88 is offline   Reply With Quote
Old 2010-11-30, 22:52   #1840
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
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)
}

so it now becomes this and should work.
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 is offline   Reply With Quote
Old 2010-12-01, 00:06   #1841
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

http://rosettacode.org/wiki/Substring

too hard ? wasn't this done on this forum for FaR lol
science_man_88 is offline   Reply With Quote
Old 2010-12-01, 14:29   #1842
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

10111010110112 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
I added my() in just to satisfy you even though i see no point of it.
I thought you'd like this (maybe it'll make you feel better?) -- see #4:
http://www.techradar.com/news/softwa...r-makes-909424
CRGreathouse is offline   Reply With Quote
Old 2010-12-01, 15:09   #1843
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26×131 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
I thought you'd like this (maybe it'll make you feel better?) -- see #4:
http://www.techradar.com/news/softwa...r-makes-909424
how does my help that ? nevermind I see what you mean lol.

Last fiddled with by science_man_88 on 2010-12-01 at 15:10
science_man_88 is offline   Reply With Quote
Old 2010-12-01, 15:19   #1844
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

20C016 Posts
Default

Suppressing exceptions:

never played with try and catch so never caught an error in my code to suppress lol.
science_man_88 is offline   Reply With Quote
Old 2010-12-01, 15:20   #1845
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

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 is offline   Reply With Quote
Old 2010-12-01, 15:23   #1846
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

20C016 Posts
Default

Not being up to date:

probably my second worst one.

my number 1 might be #1 lol
science_man_88 is offline   Reply With Quote
Old 2010-12-01, 15:37   #1847
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3×1,993 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
Suppressing exceptions:

never played with try and catch so never caught an error in my code to suppress lol.
Yes, by doing nothing you have actually been doing it the right way.

Having said that, trap() is occasionally useful.
CRGreathouse is offline   Reply With Quote
Old 2010-12-01, 15:53   #1848
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

26·131 Posts
Default

Quote:
Originally Posted by CRGreathouse View Post
Yes, by doing nothing you have actually been doing it the right way.

Having said that, trap() is occasionally useful.
Yeah same with comment(s) like they say no passwords in plain text 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.

Last fiddled with by science_man_88 on 2010-12-01 at 15:54
science_man_88 is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why do I sometimes see all the <> formatting commands when I quote or edit? cheesehead Forum Feedback 3 2013-05-25 12:56
Passing commands to PARI on Windows James Heinrich Software 2 2012-05-13 19:19
Ubiquity commands Mini-Geek Aliquot Sequences 1 2009-09-22 19:33
64-bit Pari? CRGreathouse Software 2 2009-03-13 04:22
Are these commands correct? jasong Linux 2 2007-10-18 23:40

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


Fri Aug 6 23:01:49 UTC 2021 up 14 days, 17:30, 1 user, load averages: 3.99, 4.10, 4.01

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

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.