Hi,<br><br>You might not need a tokenizer.<br>Probably something like that should do it:<br><br>(with-input-from-file <br> "my-file.txt" #:mode 'text<br> (lambda ()<br> (let loop ([numbers '()]<br>
[line (read-line)])<br> (if (eof-object? line)<br> (reverse numbers)<br> (loop<br> (cons <br> (filter (lambda(x)x)<br> (map string->number <br>
(regexp-split #px"\\s+" line)))<br> numbers)<br> (read-line))))))<br><br>Lines are read one by one, and each line is split on spaces with regexp-split, then empty values are removed (with filter), strings are turned into numbers with string->number, and all the values are consed into a list of list of numbers.<br>
<br>Hope this helps,<br>Laurent<br><br><br><div class="gmail_quote">On Sun, Nov 8, 2009 at 08:41, <span dir="ltr"><<a href="mailto:krhari@ccs.neu.edu">krhari@ccs.neu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
I have a file which contains data like this<br>
<br>
2.5500000e-002 3.6238983e-002<br>
2.5500000e-002 3.6238638e-002<br>
2.5500000e-002 3.6237603e-002<br>
...<br>
<br>
I am working on a small animation I need these numbers to calculate some things there... I am using 2htdp/universe teachpack...<br>
<br>
I actually found string->tokenize function in SRFI doc... Can I use it? If yes can anyone guide me how to use SRFI? If no is there any other way out other than converting the file into a string then using sting->list and doing it in brute force way?<br>
<br>
If I use file->string, I get a string like this<br>
" 2.5500000e-002 3.6238983e-002\r\n 2.5500000e-002 3.6238638e-002\r\n 2.5500000e-002 3.6237603e-002\r\n"<br>
<br>
Please help me out...<br>
<br>
Thanks<br>
Hari<br>
_________________________________________________<br>
For list-related administrative tasks:<br>
<a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme" target="_blank">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a><br>
</blockquote></div><br>