[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: read-from-string



At 10:03 AM 7/20/94 -0400, Michael D. Young wrote:
>Hi all,
>Is this a bug or am I doing something wrong?
>
>
>        ? (read-from-string "fred" :start 3)
>        FRED
>        4
>
>I believe this should return:
>
>
>
>        D
>        4
>

This is one of the most common errors a beginning Lisp programmer makes
(and sometimes grizzled ones too!).  READ-FROM-STRING accepts both optional
args and keyword args.  If you want to specify only the keyword args, you must
give placeholders for the two optional arguments.  In the call above, your
:start is the value of the optional arg eof-error-p and your 3 is the value of
the eof-value.  The call (read-from-string "fred" nil nil :start 3) gives the
answer you're expecting.


>
>Thanks,
>
>
>Michael D. Young
>Mershon International Studies Review
>e-mail: myoung@magnus.acs.ohio-state.edu
>tel: 614-292-5905
>fax: 614-292-2407