![]() |
|
|
#1926 | |
|
"Forget I exist"
Jul 2009
Dumbassville
26×131 Posts |
Quote:
Code:
read_file_completely(file)= a=Vec(Str(read(file)));for(x=1,#a,print(a[x])) when i then use, p="E:\\output.txt" it gives me *** error opening input file: E:\output.txt if we can get around that it's home free. doh i know why i deleted that file lol. Code:
(14:35) gp > read_file_completely(p="E:\\modulo.txt") 369369369369369369369369369369 Last fiddled with by science_man_88 on 2010-12-02 at 18:37 |
|
|
|
|
|
|
#1927 | |
|
Aug 2006
135338 Posts |
Quote:
That leaves if and maybe trap. You could also add && and || (or their short forms & and |) because they short-circuit: 1&print("this happens"); 0&print("this doesn't"); |
|
|
|
|
|
|
#1928 | |
|
Aug 2006
3×1,993 Posts |
Quote:
But I think this task is not solvable because GP evaluates the contents of the file so two files that are different but evaluate to the same thing can't be distinguished. |
|
|
|
|
|
|
#1929 | |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
Quote:
though 0 seemed to mess it up as well if all numerical.if we can get past that, and I have an idea how,but I don't know how slow it would be. Last fiddled with by science_man_88 on 2010-12-02 at 19:17 |
|
|
|
|
|
|
#1930 | |
|
Aug 2006
3×1,993 Posts |
Quote:
"c:\\documents and settings\\foo\\bar.gp" but about replacing them with slashes, which as it happens do not need to be escaped: "c:/documents and settings/foo/bar.gp" This is, as I understand, an artifact of the system (cygwin? mingw?) that underlies the Windows version of GP. |
|
|
|
|
|
|
#1931 | |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
Quote:
Last fiddled with by science_man_88 on 2010-12-02 at 19:39 |
|
|
|
|
|
|
#1932 | |
|
Aug 2006
3·1,993 Posts |
Quote:
|
|
|
|
|
|
|
#1933 |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
|
|
|
|
|
|
#1934 | |
|
Aug 2006
3×1,993 Posts |
Quote:
2. You wouldn't get the contents of the file but the contents of the edited file; you'd need to remember what you changed and change it back. This would probably be very hard to do. |
|
|
|
|
|
|
#1935 | |
|
"Forget I exist"
Jul 2009
Dumbassville
26·131 Posts |
Quote:
Code:
(16:28) gp > read_file_completely(file)= b=[];a=eval(Vec(Str(read(file))));b=concat(a,b);
(16:28) gp > read_file_completely("e:\\modulo.txt")
%279 = [3, 6, 9, 3, 6, 9, 3, 6, 9, 3, 6, 9, 3, 6, 9, 3, 6, 9, 3, 6, 9, 3, 6, 9, 3, 6, 9, 3, 6, 9]
Last fiddled with by science_man_88 on 2010-12-02 at 20:28 |
|
|
|
|
|
|
#1936 |
|
"Forget I exist"
Jul 2009
Dumbassville
838410 Posts |
on another script:
http://rosettacode.org/wiki/Day_of_the_week is in the can't be done etc. but: http://rosettacode.org/wiki/Five_weekends in the to do list would use it. |
|
|
|
![]() |
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 |