[Maxima] reading integers from a stream
caruso at dm.unipi.it
Thu Sep 20 11:10:35 CDT 2007
It could work but as you said it would not
work in the next version of Maxima.
So maybe I should find some other solution or
simply give up for the moment using directories with
capital letters when using files in Maxima.
Hoping that the next version of Maxima allows
reading integers from stream even those
whose paths have capital letters.
On Thu, 20 Sep 2007, van Nek wrote:
> Hi Fabrizio,
> I checked on ubuntu that openr handles paths case sensitive.
> parsetoken (which won't be in Maxima 5.14 anymore) uses the Lisp parser, so perhaps it is
> faster than parse_string.
> I hope the below code can help you.
> Volker van Nek
> 123 234 345
> 456 567 678
> 789 890 900
> (%i1) stream: openr("/home/volker/Work/myFile.txt");
> (%o1) #<INPUT BUFFERED FILE-STREAM CHARACTER /home/volker/Work/myFile.txt
> (%i2) while ( stringp( line: readline(stream) ) ) do (
> listOfStrings: split(line),
> listOfNumbers: if stringp(listOfStrings) then map(parsetoken,listOfStrings) else ,
> print(listOfNumbers) );
> [123, 234, 345]
> [456, 567, 678]
> [789, 890, 900]
> (%o2) done
> (%i3) close(stream);
> (%o3) true
> Am 20 Sep 2007 um 16:43 hat Fabrizio Caruso geschrieben:
>> It seems to work in a non-case-sensitive way.
>> I am using Linux and the path has most of the times
>> at leat one capital letter.
>> If I do this
>> I get
>> nonexistent directory: #P"/home/caruso/work/"
>> Is there a solution?
>> On Thu, 20 Sep 2007, Richard Fateman wrote:
>>>> -----Original Message-----
>>>> You may be able to read integers separated by new lines or by
>>>> spaces by
>>>> using lisp.
>>>> Try foo:?open(filename);
>>>> ?read(foo); ?read(foo); ....
>>>> Getting the filename in the right form, as a string, may be tricky.
>>> Hint ... Try foo:?open(?"c:\\temp\\numbers") for example.
>> Maxima mailing list
>> Maxima at math.utexas.edu
More information about the Maxima