[Openmcl-devel] need some help with "Unhandled exception"

Taoufik Dachraoui dachraoui.taoufik at gmail.com
Sat Dec 28 12:05:11 PST 2013


Could you please check this "Unhandled exception" and explain what is wrong
with my code

(defun var? (x)
  (and (symbolp x) (not (keywordp x)) (eq (char (symbol-name x) 0) #\?)))

(defun vars-in (expr)
  (if (atom expr)
      (if (var? expr) (list expr))
       (vars-in (car expr))
       (vars-in (cdr expr)))))

(defmacro aif (test-form then-form &optional else-form)
  `(let ((it ,test-form))
     (if it ,then-form ,else-form)))

(defun select! (pat) ; returns a list of bindings
  (print pat)
  '((it . (p b a)) (?x . 'b)))

(defmacro select-loop (pat &rest keywords-and-forms)
  (let ((bind (gensym))
        (vars (cons 'it (vars-in pat))))
    `(block select-loop
       (aif (select! ',pat)
              (let ((binds it) ,@(mapcar #'list vars))
                (declare (special , at vars))
                (loop for ,bind in binds
                   do (progn
                        (setf it (cdr (assoc 'it ,bind)))
                        ,@(mapcar #'(lambda (v) `(setf ,v (cdr (assoc ',v
                     , at keywords-and-forms)))))))

(defmacro defrule (name args &rest body)
  `(defmacro ,name ,args
     (list 'let (list ,@(mapcar #'(lambda (x) `(list ',x `',,x)) args))
       '(declare (special , at args))
       ,@(mapcar #'(lambda (x) `'(if (var? ,x) (makunbound ,x))) args)
       ,@(mapcar #'(lambda (x) `',x) body))))

(defrule ancestor (?x ?y)
   (select-loop (p ?x ?y) collect it)
   (select-loop (p ?x ?z)
                append (ancestor ?z ?y))))

? (ancestor ?x a)

Unhandled exception 10 at 0x28545, context->regs at #xb01641fc
Exception occurred while executing foreign code
 at compact_dynamic_heap + 965
received signal 10; faulting address: 0xd360000

? for help
[3422] Clozure CL kernel debugger: ?
(G)  Set specified GPR to new value
(R)  Show raw GPR/SPR register values
(L)  Show Lisp values of tagged registers
(F)  Show FPU registers
(S)  Find and describe symbol matching specified name
(B)  Show backtrace
(T)  Show info about current thread
(M)  Show memory areas
(X)  Exit from this debugger, asserting that any exception was handled
(P)  Propagate the exception to another handler (debugger or OS)
(K)  Kill Clozure CL process
(V)  Show Subversion revision information
(?)  Show this help
[3422] Clozure CL kernel debugger: B
current thread: tcr = 0x2000f0, native thread ID = 0xbe03, interrupts

Bogus frame 606b40
[3422] Clozure CL kernel debugger: L
[3422] Clozure CL kernel debugger:

Kind regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20131228/91081d5d/attachment.htm>

More information about the Openmcl-devel mailing list