Re: a better question

"Dan T. Abell" <[email protected]>
Newsgroups gmane.comp.tex.metapost
Message-ID <[email protected]>
You might consider having a look at some work done by Anthony Phan:
http://www-math.univ-poitiers.fr/~phan/statsmac.html <http://www-math.univ-poitiers.fr/~phan/statsmac.html>
He implemented a readdata function, which might do what you want.
At a minimum, you could examine his implementation.

Cheers,
Dan

> On 5 Jan 2017, at 14:37, Walt Burkhard <[email protected]> wrote:
> 
> Hello
> 
> I have a short metapost program attached the uses the reads from and
> scan token commands.   I do not understand why the program works 
> in the way it does.     There are two files:   the file named stringTest
> contains one line  2.56  7.23   The file named test.mp <http://test.mp/> is shown below.
> 
> numeric n ;   string jkjk ;
> 
> jkjk := readsfrom ( "stringTest" ) ;  message ( jkjk ) ;    % shows 2.56  7.23
> 
> n := scantoken ( jkjk ) ;       % this parses/reads  2.56  and sets n to be 2.56
>                                           % evidently.
> message ( "n = "&decimal n ) ;        % shows n = 2.56
> 
> n := scantoken ( jkjk ) ;       % still sets n to be 2.56
> 
> I have attached both files here.  Any suggestions on how I should be reading the 
> second numeric value from the string would be appreciated.   The User's guide
> says that the scantoken command processes tokens sequentially. (page 17)
> 
> Many thanks in advance.  
> 
> Walt Burkhard
> <test.mp><stringTest>--
> http://tug.org/metapost/

--
http://tug.org/metapost/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.