8read-char-no-hang &optional input-stream eof-error-p eof-value recursive-p 它类似于read-char字符,但是如果它没有得到一个字符,它不会等待一个字符,但立即返回为nil。 9clear-input &optional input-stream 它清除与输入流关联的所有缓冲的输入。 10read-from-string string &optional eof-error-p eof-...
前述的函数若使用 read-line 来获得使用者输入会比较好,然后对结果字符串调用 read-from-string 。这个函数接受一个字符串,并返回第一个读取的表达式: > (read-from-string "a b c") A 2 它同时返回第二个值,一个指出停止读取字符串时的位置的数字。 在一般情况下, read-from-string 可以接受两个选择...
* (defparameter *my-downcase-string* (nstring-downcase *my-string*)) *MY-DOWNCASE-STRING* * *my-downcase-string* "big" * *my-string* "big" 要注意的是这些函数的潜在功能,根据HyperSpec中的注解:“对于string-upcate,string-downcate和string-capitalize,源字符串是不会被更改的。然而,如果没有字符...
CL-USER> (make-pair :left "foo" :right "bar")#S(PAIR :LEFT "foo" :RIGHT "bar")CL-USER> (pair-right (read-from-string (prin1-to-string *)))"bar" prin1-to-string和read-from-string是互补的 Lisp 函数,它们允许以计算机可读的形式打印值(如果提供了适当的 print-function(打印函数)),并...
read-from-string string & amp;optional eof-error-p eof-value & amp;key :start :end :preserve-whitespace 它一次从字符串的字符中生成一个 LISP 对象,然后返回该对象。此外,它还返回字符串的长度(或长度 + 1),或字符串中未读取的第一个字符的索引。
read-byteread-charread-char-no-hangread-delimited-listreader-errorread-from-stringread-lineread-preserving-whitespaceread-sequencereadtablereadtable-casereadtableprealrealprealpartreducereinitialize-instanceremremfremhashremoveremove-duplicatesremove-ifremove-if-notremove-methodremproprename-filerename-package...
你或许想要避免使用read来直接处理使用者的输入。前述的函数若使用read-line来获得使用者输入会比较好,然后对结果字符串调用read-from-string。这个函数接受一个字符串,并返回第一个读取的表达式: > (read-from-string "a b c") A 2 它同时返回第二个值,一个指出停止读取字符串时的位置的数字。
#read-from-string "(a b c)" ==> (a b c),7 # prin1 print pprint princ (write-to-string obj) #(write-string str stream) #换行 (terpri outstream) fresh-line相同 #finish-output clear-output 清空缓冲区 ;(y-or-n-p "are you ok? ") ...
Syntax: (read-byte stream)Reads a byte from a stream and returns it.read-from-string functionSyntax: (read-from-string string)Reads an atom or list from the specified string and returns it.For example:> (eval (read-from-string "(* 7 8)")) 56...
(option(read-from-string (if(eq(lengthr-l)0) "default"r-l))) (cond((eq'y option) (remove-word-spell(getf*the-word*:spell)) (setf*the-word*nil) (formatt"~c[2J~c[H"#\escape #\escape) (formatt"Neatly-done.~%") (