[Ecls-list] define-modify-macro and let+ problem

Juan Jose Garcia-Ripoll juanjose.garciaripoll at gmail.com
Fri Aug 24 12:28:21 UTC 2012


On Mon, Aug 20, 2012 at 4:52 PM, Tara Lorenz <tara at terralonza.de> wrote:

> while trying to get cl-num-utils running on ECL i encountered a problem
> with let-plus in combination with define-modify-macro.
>
> Informal description: When define-modify-macro defines a three-argument
> "modifier", ECL complains about  "wrong number of arguments" when used in
> combination with let-plus and structure slots.  I see no problems when
> used outside of let-plus.  I also see no problems when i use a two
> argument modifier.
>

I believe the problem is in the SYMBOL-MACROLET used by LET+. LET+ encloses
everything on a SYMBOL-MACROLET that defines expansions for the LET+
arguments. The problem is that some of the LET+ symbols that you used, MEAN
and TALLY, are also used in the LAMBDA form from the define-modify-macro.
In other words, your code is roughly equivalent to

(LET ((#:VALUE210 ACCUM))
  (DECLARE (IGNORABLE #:VALUE210))
  (SYMBOL-MACROLET ((MEAN (MEAN-ACCUMULATOR-MEAN #:VALUE210))
                    (TALLY (MEAN-ACCUMULATOR-TALLY #:VALUE210)))
    (INCF TALLY)
    (INCF-NOOP TALLY 1)
    (INCF-MEAN MEAN VALUE TALLY)))

When INCF-MEAN is expanded to

(LET* ((#:G205 VALUE) (#:G206 TALLY))
  (DECLARE (:READ-ONLY #:G205 #:G206))
  (SETQ MEAN
          ((LAMBDA (INCF-TEST::MEAN INCF-TEST::VALUE INCF-TEST::TALLY)
             (+ INCF-TEST::MEAN
                (/ (- INCF-TEST::VALUE INCF-TEST::MEAN) INCF-TEST::TALLY)))
           MEAN #:G205 #:G206)))

the uses of VALUE and MEAN in the lambda form are interfered by the
SYMBOL-MACROLET.

Juanjo

-- 
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://juanjose.garciaripoll.googlepages.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20120824/b6d5594f/attachment.html>


More information about the ecl-devel mailing list