[metapost] a better question

Dan T. Abell dabell69 at earthlink.net
Thu Jan 5 22:54:28 CET 2017


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 <burkhard at cs.ucsd.edu> 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/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/metapost/attachments/20170105/94d8c574/attachment.html>


More information about the metapost mailing list