From: András Murányi muranyia@gmail.com To: PD List pd-list@iem.at Sent: Wed, June 30, 2010 2:25:04 PM Subject: Re: [PD] Problem with Textfile and line with float
You can also see what Chris McCormick's s-abstractions can do for you. I use s-map to handle big 'tables' (many rows of long lists they are). It doesn't need 'list' at the beginning of the lines :)
Andras
The [textfile] object, which is used inside [s-map], doesn't need 'list' at the beginning of the lines, either. However, once [textfile] outputs a message that looks like ill-formed to Pd, you'll get an error and won't be able to do anything with the data. (Try reading text-float.txt from the original post with [s-map] and sending it a "find x" message-- you'll get the error originally mentioned in this thread.)
Since it's impossible to know whether an arbitrary text file will generate ill-formed messages when output by [textfile], it'd be useful if there were an object that could output each line of a text file as a list (or maybe there already is an external that does this?). "float foo 1 2 3" in text file -> "list float foo 1 2 3" in Pd "symbol foo" in text file -> "list symbol foo" in Pd "list" -> "list list" "bang" -> "list bang" etc.
Then something like [s-map] could take a list output by such an object and use [list split 1] to get at the first element of the data without any error.
(I was about to try screwing around with the code of [textfile] to see if I could achieve this with my [lack of] c skills, but my linux box just died.)
-Jonathan