[lice @ .darcsignore: put ignore file under control, and ignore fasl files.]
[lice.git] / global.lisp
blob1b6c4ad78440f635008434b9b45df02957efc670
1 (in-package :lice)
3 (defconstant +debug-v+ 1)
4 (defconstant +debug-vv+ 2)
5 (defconstant +debug-vvv+ 3)
7 (defparameter *debug-level* +debug-v+)
8 ;;(defparameter *debug-level* +debug-vvv+)
10 (defmacro dformat (lvl &rest fmt-args)
11 ;; (let ((f (gensym)))
12 ;; `(when (>= *debug-level* ,lvl)
13 ;; (with-open-file (,f #p"/tmp/debug" :direction :output :if-exists :append
14 ;; :if-does-not-exist :create)
15 ;; (format ,f ,@fmt-args))))
18 (defmacro verbose-body (&body body)
19 "Print each sexpr in BODY and its return value."
20 (let ((ret (gensym "RET")))
21 (loop for i in body
22 collect `(let ((,ret ,i))
23 (format t "~s => ~s~%" ,i ,ret)
24 ,ret))))
26 (defun last1 (l)
27 "Return the last elt of the list."
28 (car (last l)))
30 (defun nconc1 (list item)
31 "destructively append ITEM to the end of L"
32 (nconc list (list item)))
34 ;; (defun grow-vector (vector amt initial-element)
35 ;; "grow the vector's size by AMT elements"
36 ;; (adjust-array vector (+ (length vector) amt)
37 ;; :initial-element initial-element
38 ;; :fill-pointer t))
40 ;; (defun vector-append (vector1 vector2)
41 ;; "append vector2 to the end of vector1."
42 ;; (let ((len (length vector1)))
43 ;; (grow-vector vector1 (length vector2) (elt vector2 0))
44 ;; (replace vector1 vector2 :start1 (1+ len) :start2 1)))
46 (define-condition lice-condition ()
47 () (:documentation "The base condition for all lice related errors."))
49 ;; (defun fmt (fmt &rest args)
50 ;; "A movitz hack function. FORMAT basically doesn't work, so i use this to get around it."
51 ;; (let ((s (make-array 100 :fill-pointer 0 :element-type 'character)))
52 ;; (apply #'format s fmt args)
53 ;; s))
55 #-(or sbcl cmucl mcl clisp)
56 (defun read-from-string (string)
57 "Read the string and return an sexpr. This is a MOVITZ hack
58 because it doesn't have read-from-string."
59 (muerte::simple-read-from-string string))
61 (provide :lice-0.1/global)