that is simpler, indeed :)<br><br><div class="gmail_quote">On Sun, Nov 8, 2009 at 10:02, Jos Koot <span dir="ltr"><<a href="mailto:jos.koot@telefonica.net">jos.koot@telefonica.net</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;">
Why not using just read? For the first read you would find:<br>
(read port) --> 2.5500000e-002<br>
If your file contains numers only:<br>
<br>
; read a file containing numbers and return the list of these numbers.<br>
(define (read-file-of-numbers port) ; unchecked code!<br>
(let ((item (read port)))<br>
(if (eof-object item) '( )<br>
(cons item (read-file-of-numbers port)))))<br>
<br>
In fact the above routine can be used for any file that contains a sequence of sexprs and would return a list of the sexprs.<br>
<br>
Jos<br>
<br>
----- Original Message ----- From: <<a href="mailto:krhari@ccs.neu.edu" target="_blank">krhari@ccs.neu.edu</a>><br>
To: "plt-scheme" <<a href="mailto:plt-scheme@list.cs.brown.edu" target="_blank">plt-scheme@list.cs.brown.edu</a>><br>
Sent: Sunday, November 08, 2009 8:41 AM<br>
Subject: [plt-scheme] How to get tokenize a string?<div><div></div><div class="h5"><br>
<br>
<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>
<br>
</blockquote>
<br>
<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>
</div></div></blockquote></div><br>