uri - 如何使用 Common Lisp 中名为 Quri 的替代库获得相同的 puri:uri-parsed-path 输出?
问题描述
使用 CL (SBCL) 和 Puri 库,我得到了 Slime 的 REPL:
CL-USER> (puri:uri-parsed-path (puri:parse-uri "http://www.gnu.org/software/emacs/manual/html_node/emacs/index.html"))
(:ABSOLUTE "software" "emacs" "manual" "html_node" "emacs" "index.html")
我正在尝试使用Quri而不是 Puri 来实现相同的输出(包含 URL 路径中的拆分项的列表)。
不幸的是,我没有实现它。我试过了quri-parse-path
:
CL-USER> quri-object
#<QURI.URI.HTTP:URI-HTTP http://www.gnu.org/software/emacs/>
CL-USER> (quri:parse-path (quri:uri-path quri-object))
"/software/emacs/"
0
16
库是否已经支持此操作?
我不确定它是否仅通过阅读 Quri 的文档。不过,我仍然是 CL 的菜鸟。
解决方案
我建议获取uri路径,并用“/”分割:
(quri:uri "http://www.gnu.org/software/emacs/manual/html_node/emacs/index.html")
#<QURI.URI.HTTP:URI-HTTP http://www.gnu.org/software/emacs/manual/html_node/emacs/index.html>
(quri:uri-path *)
"/software/emacs/manual/html_node/emacs/index.html"
(ql:quickload "str")
(str:split "/" * :omit-nulls t)
("software" "emacs" "manual" "html_node" "emacs" "index.html")
推荐阅读
- javascript - 使用模获得范围内的随机整数
- mysql - 如何将描述符列定义为 Doctrine 中类表继承的 ENUM?
- csv - Jmeter:从 Jmeter 中的 CSV 文件中读取数据(数字)
- jquery - 填充 Chrome 与 Firefox
- javascript - 将 ajax 响应属性放入 Google 图书封面图片的变量中
- numpy - 如何从 Gensim TFIDF 值执行 kmean 聚类
- jquery - Datetimepicker 发送两个请求
- hp-uft - 如何等待对象和页面加载
- bitcoinj - 使用 bitcoinJ 开发比特币钱包时谁收取费用
- javascript - 无需安装 npm 即可下载 npm dist 包