On Sat, Jan 29, 2011 at 11:23:54AM +0900, Alex Shinn wrote: > So by deliberately limiting match we force people > to write faster code. At the same time, it's more > verbose code - if you really want a match as powerful > as prolog you could implement it and deal with the > fact that it can be very slow in some cases. And in > that case you will eventually need to add a way to > explicitly commit matches (i.e. "cut" in prolog) for > decent performance. > > [I'm not completely consistent in this, though, > because the tree patterns I added do in fact > require more complex searching and backtracking. > But tree searches require this in general.] >
Alex, will you explain what I'd doing wrong here using tree searching patterns? (pretty-print (map (match-lambda (('foo *** '(bar 1)) #t) (_ #f)) '((foo (bar 1)) (foo (a (bar 1))) (foo (a (b (bar 1)))) (foo (a (b (c (bar 1)))))))) Only the first form |(foo (bar 1))| is returning #t here. The remaining forms return #f. I would expect all of them to return true, based on my naive understanding of the *** operator. -Alan -- .i ko djuno fi le do sevzi _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users