Re: [CS3304_1381] Help with cut

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

Nathan Conklin (Nathan.Conklin@VT.EDU)
Tue, 25 Apr 2000 02:51:30 -0400


Message-ID:  <200004250651.CAA12678@e115101.vtacs.com>
Date:         Tue, 25 Apr 2000 02:51:30 -0400
From: Nathan Conklin <Nathan.Conklin@VT.EDU>
Subject:      Re: [CS3304_1381] Help with cut

>
> 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).

This is difficult to respond to, but your code doesn't seem to be
expressing what you are trying to do:

(End \= [])
(not(End = []))

Are these supposed to evaluate differently?

> How do I get it to start at the beginning of the list of my factor
> predicates instead of somewhere else?

Prolog will step through each predicate in order as long as the predicates
have the same name, number of parameters, and the parameter variables match
to the instantiation (i.e. lists that can be broken down as described).

> However when I was operating it inside the full program (it was called
> from something else), it would not work correctly.

Hmm, you could trace through it. If you are not familiar with traces in
Prolog, I would suggest simple write statements. Make sure that the "full
program" is calling the predicate in the same manner.

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

Correctness is covered within the program text section within the
guidelines.

--
Nathan Conklin
Nathan.Conklin@vt.edu
540-953-2254


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:51:35 EDT