I'm having a hard time getting the program in Figure 13.13 to run correctly. I have included the clauses on page 305. When I run

andor(a, Solution).

I get an error saying:

ERROR: evaluate/2: Undefined procedure: h/2

Is there an error in the code? In procedure evaluate there is a call to h(Node, H). Shouldn't this rather be f(Node, H)? I try this but when I run the above command I get "no" as a result.

Please help!!!]]>

I am doing question 2 for assignment 4 buit somehow end up with a precondition that contains on(Block,b). This (or an form of it) doesn't exist in the initial state - am I doing somethign wrong? I have a very minimal grasp of what we are supposed to be doing so don't know if this is right or wrong and if it is wrong, where I went wrong.

Thanks

Celene]]>

]]>

Ass3 Q4 is mostly done, except that I'm not sure how to get

The documentation says

"setof/3 is like bagof/3 above except the list List is sorted according to the standard order and any duplicates are removed."

Umm, what exactly is the 'standard order', and what if you're inclined towards a new (world) order?]]>

I'm a little stuck with Q3 of Ass3. The point of the exercise is to use assertz and retract to store/remove the paths. Using assertz is fine, and all the required paths are happy added to the database. Using retract is a huge problemo at the moment, since I can't get Amzi/Prolog to retract the path just expanded.

If I use the following statement:

initial_state(X),

assertz(path([X])).

I have no problems. Unfortunately, the opposite doesn't work:

path(X),

retract(path(X)).

On the other hand, if I explicitly say

retract(path([whatever])).

it works! Obviously I can't explicitly program all my retract statements...

Please could someone let me know why this isn't working? Maybe there's a problem with the path already being instantiated in the first term, and so the retract function can't remove it, but how then are we to tell the retract function which path to remove (without keeping it in a dynamic list???)?

Thanks in advance (Apologies for the encyclopedia above...)

Mac]]>

[a1,a2,o,b1,b2][b1,b2,o,a1,a2][a1,o,a2,b1,b2][a1,b1,a2,o,b2] etc etc etc?

Thanks

cElene]]>

Im a bit confused as I seem to have somehow only got 10 credits, I thought it was supposed to be 40 credits for a satisfactory attempt?

I left one or two questions out i think, but for the most part they were answered and correct, any idea what counts as a satisfactory attempt for this subject? ;/]]>

Okay, Ass2 Q5. Does anyone know how to chop a list in half? We can use

My best guess is that there's a sneaky way to use difference lists which can get you 2 similarly-sized halves, but I honestly can't see a solution. Please could someone throw me a bone here? Ta]]>

Okay, I've been trying to work out exercise 8.2 (p194), and eventually checked the answer at the back... The answer to defining the

add_at_end(L1 - [Item|Z2], Item, L1 - Z2).

I've read the relevant bits in the book and I simply don't get where the - (minus) comes from. The last paragraph on p185 mentions that the pair of lists would be referred to as L1-L2 for brevity, but I didn't think it was actually Prolog notation. Does L1-L2 make sense programatically? Can we say the following:

?- L1 = [a,b,c,d,e],

L2 = [d,e],

L3 = L1-L2.

Also, when using

?- add_at_end([a,b,c|T1]-T1, [d,e], L).

T1 = [[d,e] | H759]

L = [a,b,c,[d,e] | H759] - H759

Is there a way to 'neaten' the answer, or will the output always have this form? Is seams to me that although this makes the program more 'efficient', it is no longer 'correct' in that the answer has more information than it should have.]]>

Write a procedure satisfy(P,L) that receives a unary predicate symbol P and returns the

list L of all terms X such that P(X) succeeds.

Is there part of the question missing? Can someone please tell me exactly what is required or at least point me in the right direction.

Thanks

Celene]]>

"Try to write robust programs, i.e. make provision for all possible inputs to the program, displaying error messages or warnings where appropriate."

Since chapters 1 to 3 don't cover any such matters, are we expected to do anything other than comment the code clearly?

Thanks - Good luck to ya'all]]>

I've only registered yesterday for all my courses. Can anyone please post when the 1st assignment is due and what text book we gotta get. i'm assuming i'll only be on the system in about a weeks time. so right now i'm in registered yet still in the dark.

Thanks

A]]>

On page 75, the author says that since * binds stronger than +, + has higher precedence. Now that seems backwards to me, since the operator with the highest precedence should surely be performed first (leaving the result for the other operator).

On the next 2 pages, the author describes yfx as a operator with 1st argument precedence higher than the 2nd, and thus a-b-c should be interpreted as (a-b)-c, i.e. higher predence first! This makes sense, but it contradicts what was said earlier. Right?!?]]>

"If the list contains more than n elements, an error message Ã¢â‚¬Ëœlist is too longÃ¢â‚¬â„¢ should be displayed."

Now, there is no reference to this "n" anywhere else, so for me it can only be another parameter. That is, the form will be something like:

find_min_and_max(L, Min, Max, N)

with L being the list, Min the minimum, Max the maximum, and N the value for "n".

This extra parameter just doesn't feel right to me. It seems a clumsy, contrived addition just to have a value for "n".

So, I feel there must be something missing here, something that makes the value of "n" more meaningful.

Any thoughts on this? I'm going with this for now, but I would really like to change it, if somebody could come up with a better idea. Thanks for your time. :)

]]>

I did find that \= = does the job....

cElene]]>

I am in Namibia and I am selling the prescribed books for the following modules:

INF420-H Human computer Interaction

INF425-N Software Project Management

INF418-P Database Design

INF417-N Software Engineering

INF460-R Capita Selecta (e-learning)

INF462-T Research for Computing

If you are interested, please, contact me ASAP because I am leaving soon.

Rut (081-2753664 from Namibia)

]]>