Hi all,
I'm trying to call a lambda returned by a function with funcall but I've 
the following error:

Cannot funcall macro functions.
    [Condition of type KERNEL:SIMPLE-UNDEFINED-FUNCTION]

Restarts:
   0: [RETEST] Rerun the test.
   1: [IGNORE] Signal a test failure and abort this test.
   2: [ABORT] Abort handling SLIME request.
   3: [ABORT] Return to Top-Level.

Backtrace:
   0: ("DEFUN (SETF MACRO-FUNCTION)" #<#1=unused-arg> #<#1#>)[:OPTIONAL]
   1: (APPLY-LINE-PROCESSORS (("items:") ("*" "first line") ("#" "second 
line") ("end")) (#<Closure Over Function "DEFUN LIST-INSERTION" 
{58A17FB9}>))
   2: ("TEST SIGNED-LIST-INSERTION")
   3: (IT.BESE.FIVEAM::RETURN-RESULT-LIST #<Function "TEST 
SIGNED-LIST-INSERTION" {5946B0C9}>)
   4: ((METHOD IT.BESE.FIVEAM::RUN-TEST-LAMBDA NIL 
(IT.BESE.FIVEAM::TEST-CASE)) (#(4 3) . #()) #<unused-arg> 
#<IT.BESE.FIVEAM::TEST-CASE SIGNED-LIST-INSERTION>)
   5: ((METHOD IT.BESE.FIVEAM::RUN-RESOLVING-DEPENDENCIES NIL 
(IT.BESE.FIVEAM::TEST-CASE)) (#(2 0 3 3) . #()) #<unused-arg> 
#<IT.BESE.FIVEAM::TEST-CASE SIGNED-LIST-INSERTION>)
   6: ((METHOD IT.BESE.FIVEAM::%RUN NIL (IT.BESE.FIVEAM::TEST-SUITE)) 
(#(4 3) . #()) #<unused-arg> #<IT.BESE.FIVEAM::TEST-SUITE LIST-TESTS>)
   7: ((METHOD IT.BESE.FIVEAM::%RUN NIL (IT.BESE.FIVEAM::TEST-SUITE)) 
(#(4 3) . #()) #<unused-arg> #<IT.BESE.FIVEAM::TEST-SUITE ALL-TESTS>)


This is how I build my lambda:

(defun list-insertion ()
   (let (open-lists)
     #'(lambda (line)
        (setf line (copy-list line))
        (multiple-value-bind (level list-type) (list-level (car line))
          (if level
              (cond ((and (eql level (length open-lists)) (eql list-type (car 
open-lists)))
                     (setf (car line) "<li>")
                     (setf line (append line '("</li>"))))
                    ((eql level (length open-lists))
                     (setf (car line) "<li>")
                     (setf line (append line '("</li>")))
                     (change-list-type line open-lists))
                    ((< level (length open-lists))
                     (setf (car line) "<li>")
                     (setf line (append line '("</li>")))
                     (let (close-tags)
                       (dotimes (i (- (length open-lists) level) line)
                         (if (eql (pop open-lists) #\*)
                             (push "</ul>" close-tags)
                             (push "</ol>" close-tags)))
                       (if (not (eql (car open-lists) list-type))
                           (change-list-type close-tags open-lists))
                           (append (nreverse close-tags) line)))
                    ((> level (length open-lists))
                     (setf (car line) "<li>")
                     (setf line (append line '("</li>")))
                     (dotimes (i (- level (length open-lists)) line)
                       (push list-type open-lists)
                       (if (eql list-type #\*)
                           (push "<ul>" line)
                           (push "<ol>" line)))))
              (progn
                (setf open-lists (reverse open-lists))
                (dotimes (i (length open-lists) line)
                  (if (eql (pop open-lists) #\*)
                      (push "</ul>" line)
                      (push "</ol>" line)))))))))


and this is where I call it:

(defun apply-line-processors (lines line-processors)
   (let (result)
     (dolist (line lines (nreverse result))
        (push (dolist (line-processor line-processors line)
                (setf line (funcall line-processor line))) result))))

I doesn't understand why the error says 'macro function' given that I'm 
trying to executing a lambda.

Any suggestion?

Thanks.

Giannandrea


Reply via email to