Documentation updates.
This commit is contained in:
		
							parent
							
								
									13c207b52b
								
							
						
					
					
						commit
						6e932bea6a
					
				| 
						 | 
					@ -0,0 +1,4 @@
 | 
				
			||||||
 | 
					* (cartprod2 '(a b c) '(1 2 3 4))
 | 
				
			||||||
 | 
					((A . 1) (A . 2) (A . 3) (A . 4)
 | 
				
			||||||
 | 
					 (B . 1) (B . 2) (B . 3) (B . 4)
 | 
				
			||||||
 | 
					 (C . 1) (C . 2) (C . 3) (C . 4))
 | 
				
			||||||
| 
						 | 
					@ -105,6 +105,8 @@ some functions I found useful.)
 | 
				
			||||||
@cl:with-package[name="kutils"](
 | 
					@cl:with-package[name="kutils"](
 | 
				
			||||||
@cl:doc(macro assoc-val)
 | 
					@cl:doc(macro assoc-val)
 | 
				
			||||||
@cl:doc(function build-list)
 | 
					@cl:doc(function build-list)
 | 
				
			||||||
 | 
					@cl:doc(function cartprod2)
 | 
				
			||||||
 | 
					@code(@include[path=examples.lisp start=1 end=5]())
 | 
				
			||||||
@cl:doc(function macroexpand-n)
 | 
					@cl:doc(function macroexpand-n)
 | 
				
			||||||
@cl:doc(function mksymb)
 | 
					@cl:doc(function mksymb)
 | 
				
			||||||
@cl:doc(function mkkw)
 | 
					@cl:doc(function mkkw)
 | 
				
			||||||
| 
						 | 
					@ -147,17 +149,7 @@ some functions I found useful.)
 | 
				
			||||||
The package has an optional reader macro that attempts to make
 | 
					The package has an optional reader macro that attempts to make
 | 
				
			||||||
Clojure-like hash table literals in the reader. For example:
 | 
					Clojure-like hash table literals in the reader. For example:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@begin(code)
 | 
					@code(@include[path=reader.lisp]())
 | 
				
			||||||
CL-USER> (gethash :foo  #{:foo :bar :baz :quux}#)
 | 
					 | 
				
			||||||
:BAR
 | 
					 | 
				
			||||||
T
 | 
					 | 
				
			||||||
CL-USER> (let ((m #{:foo :bar :baz :quux}#))
 | 
					 | 
				
			||||||
           (sethash :baz :woz m)
 | 
					 | 
				
			||||||
           (hashkeys m))
 | 
					 | 
				
			||||||
(:BAZ :FOO)
 | 
					 | 
				
			||||||
CL-USER> (hashtable-to-alist #{:a :b :c :d}#)
 | 
					 | 
				
			||||||
((:C . :D) (:A . :B))
 | 
					 | 
				
			||||||
@end(code)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
@cl:with-package[name="kutils"](
 | 
					@cl:with-package[name="kutils"](
 | 
				
			||||||
@cl:doc(function enable-hash-table-reader))
 | 
					@cl:doc(function enable-hash-table-reader))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,9 @@
 | 
				
			||||||
 | 
					CL-USER> (gethash :foo  #{:foo :bar :baz :quux}#)
 | 
				
			||||||
 | 
					:BAR
 | 
				
			||||||
 | 
					T
 | 
				
			||||||
 | 
					CL-USER> (let ((m #{:foo :bar :baz :quux}#))
 | 
				
			||||||
 | 
					           (sethash :baz :woz m)
 | 
				
			||||||
 | 
					           (hashkeys m))
 | 
				
			||||||
 | 
					(:BAZ :FOO)
 | 
				
			||||||
 | 
					CL-USER> (hashtable-to-alist #{:a :b :c :d}#)
 | 
				
			||||||
 | 
					((:C . :D) (:A . :B))
 | 
				
			||||||
							
								
								
									
										17
									
								
								kutils.lisp
								
								
								
								
							
							
						
						
									
										17
									
								
								kutils.lisp
								
								
								
								
							| 
						 | 
					@ -4,12 +4,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;;; "kutils" goes here. Hacks and glory await!
 | 
					;;; "kutils" goes here. Hacks and glory await!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun build-docs ()
 | 
					 | 
				
			||||||
  "Generate the package documentation using Codex."
 | 
					 | 
				
			||||||
  (unless (find-package :codex)
 | 
					 | 
				
			||||||
    (ql:quickload :codex))
 | 
					 | 
				
			||||||
  (codex:document :kutils))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
;;; This file contains various utilities I've written.
 | 
					;;; This file contains various utilities I've written.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun take (n lst)
 | 
					(defun take (n lst)
 | 
				
			||||||
| 
						 | 
					@ -128,5 +122,14 @@ new vector is adjustable and has a fill pointer set."
 | 
				
			||||||
(defmacro assoc-val (item alist &rest key-args)
 | 
					(defmacro assoc-val (item alist &rest key-args)
 | 
				
			||||||
  "Return the value of @c(item) in @c(alist). @c(key-args) should
 | 
					  "Return the value of @c(item) in @c(alist). @c(key-args) should
 | 
				
			||||||
contain any additional keyword arguments to @c(assoc)."
 | 
					contain any additional keyword arguments to @c(assoc)."
 | 
				
			||||||
  `(first (assoc ,item ,alist ,@key-args)))
 | 
					  `(rest (assoc ,item ,alist ,@key-args)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun cartprod2 (a b)
 | 
				
			||||||
 | 
					  "Produce the cartesian product of the two lists."
 | 
				
			||||||
 | 
					  (apply #'concatenate 'list
 | 
				
			||||||
 | 
						 (mapcar (lambda (x)
 | 
				
			||||||
 | 
							   (mapcar (lambda (y)
 | 
				
			||||||
 | 
								     (cons x y))
 | 
				
			||||||
 | 
								   b))
 | 
				
			||||||
 | 
							  a)))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -27,6 +27,7 @@
 | 
				
			||||||
           #:build-vector
 | 
					           #:build-vector
 | 
				
			||||||
	   #:extend-vector
 | 
						   #:extend-vector
 | 
				
			||||||
	   #:assoc-val
 | 
						   #:assoc-val
 | 
				
			||||||
 | 
						   #:cartprod2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	   ;; kutils-hash-tables.lisp
 | 
						   ;; kutils-hash-tables.lisp
 | 
				
			||||||
           #:enable-hash-table-reader
 | 
					           #:enable-hash-table-reader
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue