[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] matchable egg usage question
From: |
Alan Post |
Subject: |
Re: [Chicken-users] matchable egg usage question |
Date: |
Sat, 29 Jan 2011 20:09:35 -0700 |
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] matchable egg usage question, Alan Post, 2011/01/28
- [Chicken-users] Re: matchable egg usage question, Alan Post, 2011/01/28
- Re: [Chicken-users] matchable egg usage question, Alex Shinn, 2011/01/28
- Re: [Chicken-users] matchable egg usage question,
Alan Post <=
- Re: [Chicken-users] matchable egg usage question, Alex Shinn, 2011/01/29
- Re: [Chicken-users] matchable egg usage question, Alan Post, 2011/01/29
- Re: [Chicken-users] matchable egg usage question, Alex Shinn, 2011/01/29
- Re: [Chicken-users] matchable egg usage question, Alex Shinn, 2011/01/30
- Re: [Chicken-users] matchable egg usage question, Felix, 2011/01/30