Re: [CS3304_1381] Help with cut

New Message Reply About this list Date view Thread view Subject view Author view

Kevin Mescher (kmescher@VT.EDU)
Tue, 25 Apr 2000 02:24:06 -0400


Message-ID:  <4.1.20000425021003.00ab1760@mail.vt.edu>
Date:         Tue, 25 Apr 2000 02:24:06 -0400
From: Kevin Mescher <kmescher@VT.EDU>
Subject:      Re: [CS3304_1381] Help with cut

>
> Using cut will probably not be want you want in most cases. This is
>because you want the backtracking mechanism of Prolog to help out. What I
>suggest doing is implementing your OR conditions similar to:
>
>if(cond)
> pred1;
>else
> pred2;
>
>(cond,pred1);
>(not(cond),pred2).
>

I've got a problem with that.

Here's the code snippet:

(End \= []) ,evaluate([Answer|[After|End]], Answer, Error);
(not(End = [])), true.

This is supposed to exit if the end of the list is null (it's evaluated the
last answer, and I need to exit evaluate), but it doesn't. It goes ahead and
attempts to retry predicates before that, totally screwing up the answer (and
possibly giving me infinite recursion).

I've been playing with this type of problem, and other weird ones all night.
If I can get this working I will be half finished, but I can't get past the
stupidity of the interpreter.

Other errors I'm having:

Sometimes when my term predicate failed (because it was looking for the
non-existent asterisk), it would retry. That is fine, but when it called
factor again, the call to factor would never pick the correct predicate. It
would skip over the (perfectly fine) predicate I wanted, and pick the one that
would fail. It would then get stuck in an infinite loop. How do I get it to
start at the beginning of the list of my factor predicates instead of somewhere
else?

Related to that, when I tried the predicate I wanted seperately, I used the
same variable format for the goal, and it evaluated perfectly. However when I
was operating it inside the full program (it was called from something else),
it would not work correctly.

<rant> I'm going to kill the interpreter, because it's making me rearrange the
order of the rules in my code to work at all. It's really starting to tick me
off. And even after I get the current problems solved, it won't be complete.
I've been wrestling with the same problem for days.

AARGGHHHH!!!!!! </rant>

If our program doesn't work completely, but our report is pretty good, how many
points would we lose?

Any help at all would be appreciated.

Thanks,

Kevin Mescher


New Message Reply About this list Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b3 on Tue Apr 25 2000 - 02:23:51 EDT