[lice @ 1/2 busted local vars]
[lice.git] / global.lisp
blob225b977d59fc1c4fe91233ffb1c9a3f526621bf9
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 (declare (ignore lvl fmt-args))
12 ;; (let ((f (gensym)))
13 ;; `(when (>= *debug-level* ,lvl)
14 ;; (with-open-file (,f #p"/tmp/debug" :direction :output :if-exists :append
15 ;; :if-does-not-exist :create)
16 ;; (format ,f ,@fmt-args))))
19 (defmacro verbose-body (&body body)
20 "Print each sexpr in BODY and its return value."
21 (let ((ret (gensym "RET")))
22 (loop for i in body
23 collect `(let ((,ret ,i))
24 (format t "~s => ~s~%" ,i ,ret)
25 ,ret))))
27 (defun last1 (l)
28 "Return the last elt of the list."
29 (car (last l)))
31 (defun nconc1 (list item)
32 "destructively append ITEM to the end of L"
33 (nconc list (list item)))
35 ;; (defun grow-vector (vector amt initial-element)
36 ;; "grow the vector's size by AMT elements"
37 ;; (adjust-array vector (+ (length vector) amt)
38 ;; :initial-element initial-element
39 ;; :fill-pointer t))
41 ;; (defun vector-append (vector1 vector2)
42 ;; "append vector2 to the end of vector1."
43 ;; (let ((len (length vector1)))
44 ;; (grow-vector vector1 (length vector2) (elt vector2 0))
45 ;; (replace vector1 vector2 :start1 (1+ len) :start2 1)))
47 (define-condition lice-condition ()
48 () (:documentation "The base condition for all lice related errors."))
50 ;; (defun fmt (fmt &rest args)
51 ;; "A movitz hack function. FORMAT basically doesn't work, so i use this to get around it."
52 ;; (let ((s (make-array 100 :fill-pointer 0 :element-type 'character)))
53 ;; (apply #'format s fmt args)
54 ;; s))
56 #+movitz
57 (defun read-from-string (string)
58 "Read the string and return an sexpr. This is a MOVITZ hack
59 because it doesn't have read-from-string."
60 (muerte::simple-read-from-string string))
62 (provide :lice-0.1/global)