Coverage report: /home/runner/work/geb/geb/src/geb/package.lisp
Kind | Covered | All | % |
expression | 0 | 28 | 0.0 |
branch | 0 | 0 | nil |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5
(geb.utils:muffle-package-variance
7
(:documentation "Gödel, Escher, Bach categorical model")
8
(:use #:common-lisp #:geb.generics #:geb.extension.spec #:serapeum #:geb.mixins #:geb.utils #:geb.spec)
9
(:local-nicknames (#:poly #:geb.poly.spec) (#:bitc #:geb.bitc.spec) (#:seqn #:geb.seqn.spec))
10
(:shadowing-import-from #:geb.spec :left :right :prod :case)
11
(:export :prod :case :mcar :mcadr :mcaddr :mcdr :name :func :obj :dom :codom
14
(in-package #:geb.main)
16
(pax:defsection @geb-utility (:title "Utility")
17
"Various utility functions ontop of @GEB-CATEGORIES"
18
(pair-to-list pax:function)
19
(same-type-to-list pax:function)
22
(commutes pax:function)
23
(commutes-left pax:function)
25
(so-eval (pax:method () (<natobj> t)))
26
(so-eval (pax:method () (<substobj> t)))
27
(so-hom-obj (pax:method () (<natobj> t)))
28
(so-hom-obj (pax:method () (<substobj> t)))
29
(so-card-alg pax:generic-function)
30
(so-card-alg (pax:method () (<substobj>)))
32
(coprod-mor pax:function)
33
(prod-mor pax:function)
34
(uncurry pax:function)
35
(text-name pax:generic-function)
37
"These utilities are ontop of [CAT-OBJ]"
38
(maybe (pax:method () (<substobj>)))
39
(maybe (pax:method () (<natobj>))))
41
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
42
;; Standard Library throughout the codebase
43
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
45
(geb.utils:muffle-package-variance
46
(uiop:define-package #:geb.common
47
(:documentation "Provides the standard library for any GEB code")
48
(:shadowing-import-from #:geb.spec :left :right :prod :case)
49
(:import-from #:trivia #:match)
50
(:use-reexport #:geb.mixins #:geb.generics #:geb.extension.spec #:geb.spec #:geb.main #:geb.utils
51
#:serapeum #:common-lisp)))
53
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
55
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
57
(geb.utils:muffle-package-variance
58
(defpackage #:geb.trans
59
(:documentation "Gödel, Escher, Bach categorical model")
60
(:use #:common-lisp #:serapeum #:geb.mixins #:geb.utils #:geb.spec #:geb.main
61
#:geb.generics #:geb.seqn.spec #:geb.seqn.main)
62
(:local-nicknames (#:poly #:geb.poly.spec) (#:bitc #:geb.bitc.spec) (#:seqn #:geb.seqn.spec))
63
(:shadowing-import-from #:geb.spec :left :right :prod :case)
64
(:export :prod :case :mcar :mcadr :mcaddr :mcdr :name :func :obj
67
(in-package #:geb.trans)
69
(pax:defsection @geb-translation (:title "Translation Functions")
70
"These cover various conversions from @GEB-SUBSTMORPH and @GEB-SUBSTMU
71
into other categorical data structures."
72
(to-poly (pax:method () (<substobj>)))
73
(to-poly (pax:method () (<substmorph>)))
74
(to-circuit (pax:method () (<substmorph> t)))
75
(to-bitc (pax:method () (<substmorph>)))
76
(to-seqn (pax:method () (<substobj>)))
77
(to-seqn (pax:method () (geb.extension.spec:<natobj>)))
78
(to-seqn (pax:method () (comp)))
79
(to-seqn (pax:method () (init)))
80
(to-seqn (pax:method () (terminal)))
81
(to-seqn (pax:method () (inject-left)))
82
(to-seqn (pax:method () (inject-right)))
83
(to-seqn (pax:method () (case)))
84
(to-seqn (pax:method () (project-left)))
85
(to-seqn (pax:method () (project-right)))
86
(to-seqn (pax:method () (pair)))
87
(to-seqn (pax:method () (distribute)))
88
(to-seqn (pax:method () (geb.extension.spec:nat-div)))
89
(to-seqn (pax:method () (geb.extension.spec:nat-const)))
90
(to-seqn (pax:method () (geb.extension.spec:nat-inj)))
91
(to-seqn (pax:method () (geb.extension.spec:one-bit-to-bool)))
92
(to-seqn (pax:method () (geb.extension.spec:nat-decompose)))
93
(to-seqn (pax:method () (geb.extension.spec:nat-eq)))
94
(to-seqn (pax:method () (geb.extension.spec:nat-lt))))
96
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
98
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
100
(geb.utils:muffle-package-variance
101
(uiop:define-package #:geb-bool
102
(:documentation "Defines out booleans for the geb language")
103
(:mix #:geb.main #:geb.spec #:serapeum #:common-lisp)
104
(:shadow :false :true :not :and :or)
106
:bool :fasle :true :not :and :or
109
(in-package #:geb-bool)
111
(pax:defsection @geb-bool (:title "Booleans")
112
"Here we define out the idea of a boolean. It comes naturally from the
113
concept of coproducts. In ML they often define a boolean like
116
data Bool = False | True
119
We likewise define it with coproducts
122
(def bool (coprod so1 so1))
124
(def true (->right so1 so1))
125
(def false (->left so1 so1))
128
The functions given work on this."
129
(true pax:symbol-macro)
130
(false pax:symbol-macro)
131
(false-obj pax:symbol-macro)
132
(true-obj pax:symbol-macro)
133
(bool pax:symbol-macro)
134
(not pax:symbol-macro)
135
(and pax:symbol-macro)
136
(or pax:symbol-macro))
139
(geb.utils:muffle-package-variance
140
(uiop:define-package #:geb-list
141
(:documentation "Defines out booleans for the geb language")
143
(:export #:@geb-list)))
145
(in-package #:geb-list)
147
(pax:defsection @geb-list (:title "Lists")
148
"Here we define out the idea of a List. It comes naturally from the
149
concept of coproducts. Since we lack polymorphism this list is
150
concrete over [GEB-BOOL:@GEB-BOOL][section] In ML syntax it looks like
153
data List = Nil | Cons Bool List
156
We likewise define it with coproducts, with the recursive type being opaque
159
(defparameter *nil* (so1))
161
(defparameter *cons-type* (reference 'cons))
163
(defparameter *canonical-cons-type*
165
(prod geb-bool:bool *cons-type*)))
168
(coprod *nil* *cons-type*))
171
The functions given work on this."
173
(*cons-type* pax:variable)
174
(*list* pax:variable)
176
(*cons* pax:variable)
178
(cons->list pax:symbol-macro)
179
(nil->list pax:symbol-macro)
180
(*canonical-cons-type* pax:variable))
182
(geb.utils:muffle-package-variance
183
(uiop:define-package #:geb-decision
184
(:documentation "Defines out a decision datatype for for the geb language")
185
(:nicknames :geb-dec) ; nicer shorthand
187
(:mix #:geb.main #:geb.spec #:serapeum #:common-lisp)))
189
(in-package #:geb-decision)
191
(pax:defsection @geb-decision (:title "Decisions")
192
"Here we define out the idea of a Decision. Namely it allows us to
193
model information that may be uncertain. In ADT terms the type would
197
(deftype decision () `(or yes no maybe))
200
In GEB terms it is defined like
204
(coprod yes (coprod no maybe)))
207
We also define out API functions to operate on this"
208
(decision pax:symbol-macro)
209
(yes pax:symbol-macro)
210
(no pax:symbol-macro)
211
(maybe pax:symbol-macro)
212
(inj-maybe pax:symbol-macro)
213
(inj-yes pax:symbol-macro)
214
(inj-no pax:symbol-macro)
215
(demote pax:symbol-macro)
216
(promote pax:symbol-macro)
217
(merge-opinion pax:symbol-macro))
221
(geb.utils:muffle-package-variance
222
(uiop:define-package #:geb
223
(:documentation "Gödel, Escher, Bach categorical model")
225
(:use-reexport #:geb.spec #:geb.trans #:geb.main)
226
(:export #:@geb #:geb-api #:@geb-examples)))
230
(pax:defsection @geb (:title "The Geb Model")
231
"Everything here relates directly to the underlying machinery of
232
GEB, or to abstractions that help extend it."
233
(@mixins-cat pax:section)
234
(@generics pax:section)
235
(@geb-categories pax:section)
236
(@geb-accessors pax:section)
237
(@geb-constructors pax:section)
238
(@geb-api pax:section)
239
(@geb-examples pax:section))
241
(pax:defsection @geb-api (:title "API")
242
"Various forms and structures built on-top of @GEB-CATEGORIES"
243
(gapply (pax:method () (<substmorph> t)))
244
(gapply (pax:method () (opaque-morph t)))
245
(gapply (pax:method () (opaque t)))
246
(well-defp-cat (pax:method () (<substmorph>)))
247
(well-defp-cat (pax:method () (<natmorph>)))
248
(well-defp-cat (pax:method () (<natobj>)))
249
(geb-bool:@geb-bool pax:section)
250
(geb-list:@geb-list pax:section)
251
(geb.trans:@geb-translation pax:section)
252
(@geb-utility pax:section))
254
(pax:defsection @geb-examples (:title "Examples")
255
"PLACEHOLDER: TO SHOW OTHERS HOW EXAMPLES WORK"
256
"Let's see the transcript of a real session of someone working
260
(values (princ :hello) (list 1 2))