[cl-unification-devel] Re: [CL-UNIFICATION] MATCH, MATCHING macro's bug?

Marco Antoniotti marcoxa at cs.nyu.edu
Mon Apr 16 19:44:54 UTC 2007


Hi Masayuki

it looks like the patch is good.

Let me do a few tests and I will check it in.

Apart from that, thanks for using CL-UNIFICATION.

Cheers

Marco





On Apr 16, 2007, at 7:00 PM, Masayuki Onjo wrote:

> Hello, Marco.
>
> I'm Masayuki Onjo, CL-UNIFICATION library user. The CL-UNIFICATION is
> very cool stuff.
> It's works well on AllegroCL's REPL, but COMPILE-FILE cause  
> following error.
>
> -- fib.lisp ---
> (defun fib (n)
>  (unify:match-case (n)
>    (0 1)
>    (#T(number n)
>       (+ (fib (- n 1)) (fib (- n 2))))))
>
>  CL-USER> (compile-file "fib.lisp")
>
>  Object #<EMPTY UNIFY ENVIRONMENT: 1 frame @ #x22b212d2> cannot be
>  written to a compiled file unless an applicable method is defined on
>  make-load-form.
>     [Condition of type PROGRAM-ERROR]
>
> It seems to be a bug of the MATCH macro expansion.
>
>  [BUG]
>   (unify ',template ,object ,substitution))
>     substitution := (make-empty-environment)
>     => (unify temlate object #<EMPTY UNIFY ENVIRONMENT: 1 frame @  
> #...>)
>
>  [CORRECT]
>   (unify ',template ,object ,substitution))
>     substitution := '(make-empty-environment)
>     => (unify temlate object (make-empty-environment))
>
> I make following patch, it works for me. I'm very happy to hacking
> with pattern-match-based macro.  Thanks for your great work!!
>
> cvs diff: Diffing .
> Index: match-block.lisp
> ===================================================================
> RCS file: /project/cl-unification/cvsroot/cl-unification/match- 
> block.lisp,v
> retrieving revision 1.6
> diff -r1.6 match-block.lisp
> 13c13
> <                            (substitution (make-empty-environment))
> ---
>>                            (substitution '(make-empty-environment))
> 63c63
> <                           (default-substitution (make-empty- 
> environment)))
> ---
>>                           (default-substitution '(make-empty- 
>> environment)))
>
> -- 
> Masayuki Onjo <onjo at lispuser.net>

--
Marco Antoniotti


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cl-unification-devel/attachments/20070416/2868929f/attachment.html>


More information about the cl-unification-devel mailing list