我最近问了一个有关SBCL的问题,其中一个响应提到了我不知道的两个功能:#'sb-ext:string-to-octets
和#'sb-ext:octets-to-string
。除了回答我的问题之外,这也告诉我我应该浏览软件包的外部符号SB- ext以查看可能使用的是什么。
我的问题(与SBCL相关的)是:除了浏览包装sb-ext的外部符号外,还有其他一些手册描述了包sb-ext和其他添加(我正在尝试避免使用该单词"扩展"是因为它是特定的技术术语)到SBCL?例如,#'sb-ext:string-to-octets
和#'sb-ext:octets-to-string
在SBCL手册中没有讨论。
正如@svante在另一个问题中指出的那样,因为我更喜欢在aptabiliyt上使用另一个图书馆,通常像babel一样有记录的。
通常,如果符号在ANSI COMMON LISP中,则通常在COMON LISP中检查DOC,您应该检查teh clhs sly and Slime对此具有出色的设施。
通常我继续执行以下操作:
CL-USER> (documentation 'sb-ext:octets-to-string 'function)
NIL
CL-USER> (describe 'sb-ext:octets-to-string)
SB-EXT:OCTETS-TO-STRING
[symbol]
OCTETS-TO-STRING names a compiled function:
Lambda-list: (VECTOR &KEY (EXTERNAL-FORMAT DEFAULT) (START 0) END)
Derived type: (FUNCTION
((VECTOR (UNSIGNED-BYTE 8)) &KEY (:EXTERNAL-FORMAT T)
(:START T) (:END T))
*)
Source file: SYS:SRC;CODE;OCTETS.LISP
; No values
描述函数始终为您提供有关符号的相关信息,然后您可以使用Sly或Slime与M-.
(defun octets-to-string (vector &key (external-format :default) (start 0) end)
(declare (type (vector (unsigned-byte 8)) vector))
(with-array-data ((vector vector)
(start start)
(end end)
:check-fill-pointer t)
(declare (type (simple-array (unsigned-byte 8) (*)) vector))
(let ((ef (maybe-defaulted-external-format external-format)))
(funcall (ef-octets-to-string-fun ef) vector start end))))
最后,您可以转到teh存储库进行阅读测试,在这种情况下,请转到GitHub SBCL repo并查找此Fucntion提供源代码测试,您可以阅读以轻松使用该功能:
https://github.com/sbcl/sbcl/search?utf8=✓&q = string-to-octets&tepte& type =
这样: