chicken-janitors
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-janitors] #487: matchable: crash matching a symbol when a produ


From: Chicken Trac
Subject: [Chicken-janitors] #487: matchable: crash matching a symbol when a production contains |...|
Date: Sun, 23 Jan 2011 05:47:07 -0000

#487: matchable: crash matching a symbol when a production contains |...|
------------------------+---------------------------------------------------
 Reporter:  alanpost    |       Owner:       
     Type:  defect      |      Status:  new  
 Priority:  major       |   Milestone:  4.7.0
Component:  extensions  |     Version:  4.6.x
 Keywords:              |  
------------------------+---------------------------------------------------
 The following program:

 {{{
 (use matchable)

 (pretty-print (map
   (match-lambda
     ((x ... y) `(,x ,y))
     (x         x))
   '((a c) (a b c) (a b b c) (a) (c) a)))
 (exit)
 }}}

 Generates the following error message:

 {{{
 Error: (length) bad argument type - not a proper list: a

         Call history:

         <eval>    (#%= n109 tail-len102)
         <eval>    (#%reverse p-ls56)
         <eval>    (#%pair? ls104)
         <eval>    (#%null? (#%cdr ls104))
         <eval>    (#%cdr ls104)
         <eval>    (#%car ls104)
         <eval>    (##sys#cons x (##sys#cons y (##core#quote ())))
         <eval>    (##sys#cons y (##core#quote ()))
         <eval>    (#%length (quote103 (y)))
         <eval>    (#%length ls104)      <--
 }}}

 I would expect the output of the program to instead be:

 {{{
 (((a) c) ((a b) c) ((a b b) c) (() a) (() c) a)
 }}}

 The error message is being generated by the final element in the map, the
 symbol |a|.  It seems to be a caused by the |...| operator in matchable.

 With the following variation (substituted a single |.| for the |...|):

 {{{
 (use matchable)

 (pretty-print (map
   (match-lambda
     ((x . y) `(,x ,y))
     (x         x))
   '((a c) (a b c) (a b b c) (a) (c) a)))
 (exit)
 }}}

 The program does not generate the error message.  It does generate a
 slightly different result, of course:

 {{{
 ((a (c)) (a (b c)) (a (b b c)) (a ()) (c ()) a)
 }}}

 I'm running Chicken experimental de033aef6860a4b76d388810e73d3927fd553e95
 on OpenBSD 4.8 in a VMWare virtual machine.

-- 
Ticket URL: <http://bugs.call-cc.org/ticket/487>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]