On 5/25/07, Robert Dodier <robert.dodier at gmail.com> wrote:
>
> On 5/25/07, Stavros Macrakis <macrakis at alum.mit.edu> wrote:
>
> > Shouldn't we call this something like parse_number? Even that is
> > misleading, because it doesn't handle bfloats.
>
> Maybe it should be revised to just be a front-end for SCAN-ONE-TOKEN-G;
> then it would recognize the same tokens as the Maxima scanner.
>
Yes, that is certainly the cleanest solution and I like it. But it does
have the disadvantage of being 45x slower, as we've seen in the recent
discussion. Also, if it's going to be useful as a general token scanner, it
needs some way of telling the calling program how far it's gotten in the
argument string, like Lisp's:
(read-from-string "12 / 19") => 12 3
(read-from-string "12/19") => 12/19 5
but of course we don't have multiple-value-return.
-s
PS Note that Lisp considers 12/19 to be one token, while Maxima considers it
to be three. Another incompatibility, though a subtle one. My recent fix
to parsetoken allows 12/19, but I'm having second thoughts.