-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaux-packages.lisp
107 lines (94 loc) · 2.82 KB
/
aux-packages.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: CL-USER; Base: 10 -*-
;;;; Copyright (c) 2014, 2015 Zlatozar Zhelyazkov
;;;; aux-packages.lisp: Packages that contain utilities and auxiliary functions
(in-package :cl-user)
;;; ____________________________________________________________________________
;;; Tools (not part of the book)
(defpackage #:inspect
(:documentation "This package is not part of the book.
It contains functions that could help during coding sessions.")
(:use #:common-lisp)
(:export #:??
#:?p
#:?p%
#:?p*
#:!!
#:?mac))
(defpackage #:pcl-test
(:documentation "Use defined in the book 'Practical Common Lisp' test framework
to test chapter exercises.")
(:nicknames #:test)
(:use #:common-lisp)
(:export #:deftest
#:check))
;;; ____________________________________________________________________________
;;; Helper functions from the book
(defpackage #:paip-aux
(:documentation "Useful functions defined in the book.")
(:use #:common-lisp)
(:shadow #:symbol
#:debug)
(:export #:mappend
;; ch03
#:find-all
#:find-all-if
#:declare-ignore
#:true
#:false
;; ch04
#:debug
#:enable-dbg ; alias of 'DEBUG'
#:undebug
#:disable-dbg ; alias of 'UNDEBUG'
#:dbg
#:dbg-indent
#:member-equal
;; ch05
#:flatten
#:mklist
#:random-elt
#:starts-with
;; ch08
#:length=1
#:find-anywhere
;; ch09
#:memoize
#:memo
#:clear-memoize
#:delay
#:force
;; ch10
#:reuse-cons
#:defresource
#:with-resource
#:queue-contents
#:make-queue
#:enqueue
#:dequeue
#:front
#:empty-queue-p
#:queue-nconc
;; ch11
#:unique-find-if-anywhere
#:find-if-anywhere
;; ch12
#:new-symbol
;; ch13
#:rest2
))
;;; ____________________________________________________________________________
;;; Run examples
(defpackage #:tutor
(:documentation "Use defined in the book test framework
and run chapter examples.")
(:use #:common-lisp)
(:import-from :paip-aux
#:starts-with)
(:export #:defexamples
#:do-examples
#:do-chapter))
(format *debug-io* "~2&
To run all examples:
(tutor:do-examples :all)
To run examples from particular chapter:
(tutor:do-examples <chapter number>)~2%")