1

我正在使用 Doug Hoyte 和 The Phoeron 的 let-over-lambda 的示例来同时建立我对 common-lisp 包、quicklisp 和 asdf 以及在 common lisp 中进行大规模编程的生产级专业实践的理解。

我能够以如下所示的方式使用该包,但还没有弄清楚如何使用类似的部分引导猜测来运行它的测试。详情如下。

我在这里找到了代码:https ://github.com/thephoeron/let-over-lambda 。我正在使用“消防软管”和“渐进式教育猜测”的方法尽可能快地将其塞进我的脑海中,并以此为指导。当然,与更结构化的方法相比,这种方法会给我留下更多模糊的知识点,但它可能会让我更快地到达山顶(请随意驳斥我的这个想法)。

以我目前的初步了解,我可以在自己的代码中使用该包。例如,我可以写

(load "~/quickload/setup.lisp") (ql:quickload "let-over-lambda") (let-overlambda:flatten '((a . b) c (d e)))

并得到

(A B C D E)

lol通过阅读“package.lisp”中的内容,我可以注意到该包定义了一个昵称defpackage,即(缩写):

(defpackage #:let-over-lambda (:nicknames #:lol) (:use #:cl #:cl-user #:cl-ppcre)

我可以使用昵称:

(lol:flatten '((a . b) c (d e)))
=> (A B C D E)

甚至导入它的导出,摆脱任何限定符号的需要:

(use:package :lol)
(flatten '((a . b) c (d e)))
=> (A B C D E)

现在,我注意到 repo 包含一个诱人的测试包和目录“t”:

-rw-r--r-- 1 921 Dec 5 05:27 let-over-lambda-test.asd -rw-r--r-- 1 941 Dec 5 05:27 let-over-lambda.asd -rw-r--r-- 1 17421 Dec 5 05:27 let-over-lambda.lisp -rw-r--r-- 1 1771 Dec 5 05:27 package.lisp drwxr-xr-x 3 102 Dec 5 05:27 t

不过,我无法弄清楚如何运行测试,这是我的问题:我该怎么做?以下是我在 sbcl 1.3.1 中尝试过的一些事情,但未成功:

* (ql:quickload "let-over-lambda-test")

debugger invoked on a QUICKLISP-CLIENT:SYSTEM-NOT-FOUND in thread
#<THREAD "main thread" RUNNING {1002ACC943}>:
  System "let-over-lambda-test" not found

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [CONTINUE] Try again
  1: [ABORT   ] Give up on "let-over-lambda-test"
  2:            Exit debugger, returning to top level.

((LABELS QUICKLISP-CLIENT::RECURSE :IN QUICKLISP-CLIENT::COMPUTE-LOAD-STRATEGY) "let-over-lambda-test")
0] 

和这个

* (load "./t/let-over-lambda.lisp")
While evaluating the form starting at line 3, column 0
  of #P"/Users/bbeckman/Documents/let-over-lambda/./t/let-over-lambda.lisp":

debugger invoked on a SB-KERNEL:SIMPLE-PACKAGE-ERROR in thread
#<THREAD "main thread" RUNNING {1002ACC943}>:
  The name "PROVE" does not designate any package.

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [RETRY   ] Retry EVAL of current toplevel form.
  1: [CONTINUE] Ignore error and continue loading file "/Users/bbeckman/Documents/let-over-lambda/./t/let-over-lambda.lisp".
  2: [ABORT   ] Abort loading file "/Users/bbeckman/Documents/let-over-lambda/./t/let-over-lambda.lisp".
  3:            Exit debugger, returning to top level.

(SB-INT:%FIND-PACKAGE-OR-LOSE "PROVE")
0] 

编辑:快速加载“证明”,如下所示,将一堆更酷的东西加载到我的环境中,但仍然让我不知道如何运行测试。我原以为“证明”会自动快速加载为defsystem“let-over-lambda-test”中的依赖项,所以这是一个小惊喜:

* (ql:quickload "prove")
To load "prove":
  Load 2 ASDF systems:
    alexandria cl-ppcre
  Install 5 Quicklisp releases:
    anaphora cl-ansi-text cl-colors let-plus prove
; Fetching #<URL "http://beta.quicklisp.org/archive/anaphora/2011-06-19/anaphora-0.9.4.tgz">
; 5.02KB
==================================================
5,136 bytes in 0.00 seconds (5015.63KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/let-plus/2013-12-11/let-plus-20131211-git.tgz">
; 10.52KB
==================================================
10,768 bytes in 0.00 seconds (0.00KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/cl-colors/2015-03-02/cl-colors-20150302-git.tgz">
; 14.11KB
==================================================
14,449 bytes in 0.06 seconds (220.47KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/cl-ansi-text/2015-08-04/cl-ansi-text-20150804-git.tgz">
; 5.74KB
==================================================
5,876 bytes in 0.00 seconds (5738.28KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/prove/2015-08-04/prove-20150804-git.tgz">
; 854.08KB
==================================================
874,578 bytes in 3.35 seconds (254.95KB/sec)
; Loading "prove"
[package alexandria.0.dev]........................
..................................................
[package anaphora]................................
[package anaphora-basic]..........................
[package anaphora-symbol].........................
[package let-plus]................................
[package cl-colors]...............................
[package cl-ansi-text]............................
[package prove.output]............................
[package prove.report]............................
[package prove.reporter]..........................
[package prove.asdf]..............................
[package prove.suite].............................
[package prove.test]..............................
[package prove.color].............................
[package prove]...................................
[package prove.reporter.tap]......................
[package prove.reporter.fiveam]...................
[package prove.reporter.list].....................
[package prove.reporter.dot].
("prove")
* (ql:quickload "let-over-lambda-test")

debugger invoked on a QUICKLISP-CLIENT:SYSTEM-NOT-FOUND in thread
#<THREAD "main thread" RUNNING {1002ACC943}>:
  System "let-over-lambda-test" not found

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [CONTINUE] Try again
  1: [ABORT   ] Give up on "let-over-lambda-test"
  2:            Exit debugger, returning to top level.

((LABELS QUICKLISP-CLIENT::RECURSE :IN QUICKLISP-CLIENT::COMPUTE-LOAD-STRATEGY) "let-over-lambda-test")
0] 2

我将不胜感激任何指导。

4

1 回答 1

3

ASDF 测试操作被定义为评估

(asdf:test-system #:let-over-lambda)

应该做的伎俩。您可能需要先加载 let-over-lambda-test 系统。

于 2015-12-13T03:57:30.720 回答