[ By Archive-name | By Author | By Category | By Newsgroup ]
[ Home | Latest Updates | Archive Stats | Search | Usenet References | Help ]

    Search the FAQ Archives

Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Single Page

Top Document: FAQ: Lisp Frequently Asked Questions 3/7 [Monthly posting]
Previous Document: News Headers
Next Document: [3-1] Why can't it deduce from (READ-FROM-STRING "foobar" :START 3) that the intent is to specify the START keyword parameter rather than


[3-0] Why does (READ-FROM-STRING "foobar" :START 3) return FOOBAR instead of BAR?



READ-FROM-STRING is one of the rare functions that takes both &OPTIONAL and
&KEY arguments:

       READ-FROM-STRING string &OPTIONAL eof-error-p eof-value 
                               &KEY :start :end :preserve-whitespace

When a function takes both types of arguments, all the optional
arguments must be specified explicitly before any of the keyword
arguments may be specified.  In the example above, :START becomes the
value of the optional EOF-ERROR-P parameter and 3 is the value of the
optional EOF-VALUE parameter.
     
To get the desired result, you should use
   (READ-FROM-STRING "foobar" t nil :START 3)
If you need to understand and use the optional arguments, please refer
to CLTL2 under READ-FROM-STRING, otherwise, this will behave as
desired for most purposes.



Top Document: FAQ: Lisp Frequently Asked Questions 3/7 [Monthly posting]
Previous Document: News Headers
Next Document: [3-1] Why can't it deduce from (READ-FROM-STRING "foobar" :START 3) that the intent is to specify the START keyword parameter rather than

Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Single Page


[ By Archive-name | By Author | By Category | By Newsgroup ]
[ Home | Latest Updates | Archive Stats | Search | Usenet References | Help ]


Send corrections/additions to the FAQ Maintainer:
ai+lisp-faq@cs.cmu.edu

Last Update July 09 2008 @ 00:13 AM

© 2008 FAQS.ORG. All rights reserved.