[Bese-devel] arnesi matcher and :greedy-star

Andreas Fuchs asf at boinkor.net
Sun Dec 7 10:39:33 UTC 2003


hi all,

I was thinking about using the arnesi matcher in a project of
mine. This would involve matching an arbitrary number of :ANYTHINGs in
a list, so I thought :GREEDY-STAR would be the perfect match (no pun
intended). Unfortunately, I can't make it work. when I try the in:

(match '(:list* (:greedy-star :anything) a 'b :anything) '(1 2 a b))

I get an error:

invalid number of arguments: 1
   [Condition of type SB-INT:SIMPLE-PROGRAM-ERROR]

Restarts:
  0: [ABORT] Reduce debugger level (leaving debugger, returning to toplevel).
  1: [TOPLEVEL] Restart at toplevel READ/EVAL/PRINT loop.

Backtrace:
0: ("XEP for #'(LAMBDA (IT.BESE.ARNESI::S IT.BESE.ARNESI::K IT.BESE.ARNESI::Q) (FUNCALL IT.BESE.ARNESI::K # ...))" 1 1 #<FUNCTION "CLOSURE" {4801B205}> 168683692)[:EXTERNAL]
1: ("#'(LAMBDA (IT.BESE.ARNESI::S IT.BESE.ARNESI::K IT.BESE.ARNESI::Q) (IF # # ...))" #S(IT.BESE.ARNESI::MATCH-STATE :TARGET 1 :BINDINGS NIL :MATCHED NIL) #<FUNCTION "CLOSURE" {4801B205}> #<FUNCTION "CLOSURE" {4801B1DD}>)
2: (MATCH #<FUNCTION "CLOSURE" {4801B195}> (1 2 A B))
3: (MATCH (:LIST* (:GREEDY-STAR :ANYTHING) A (QUOTE B) :ANYTHING) (1 2 A B))
4: (SB-INT:EVAL-IN-LEXENV 2 (MATCH (QUOTE (:LIST* # A # :ANYTHING)) (QUOTE (1 2 A B))) #S(SB-KERNEL:LEXENV :FUNS NIL :VARS NIL :BLOCKS NIL :TAGS NIL :TYPE-RESTRICTIONS NIL :LAMBDA NIL :CLEANUP NIL :POLICY ((SPEED . 1) (SPACE . 1) (SAFETY . 1) (INHIBIT-WARNINGS . 1) (DEBUG . 1) (COMPILATION-SPEED . 1))))[:EXTERNAL]
5: ("hairy arg processor for SWANK::EVAL-REGION" "(match '(:list* (:greedy-star :anything) a 'b :anything) '(1 2 a b))" T)
6: (SWANK:LISTENER-EVAL "(match '(:list* (:greedy-star :anything) a 'b :anything) '(1 2 a b)) ")

So, how should the :GREEDY-STAR matcher be used? Is it the right thing
to use at all? And why does the :ANYTHING matcher match all elements
at the end of a list, but only one element in any other position?

Thanks,
-- 
Andreas Fuchs, <asf at acm.org>, asf at jabber.at, antifuchs




More information about the bese-devel mailing list