Paul Gries
CSC324 instructor
Is there a way to load a file into xsb without it being compiled ?
The retract statment works when applied to statments entered using
assertz.
Answer: I've poked around, and it looks like this is not possible.
All it means for this assignment is that you can't modify your original
facts. One workaround is to use [user]. and cut and paste, but we don't
expect you to actually fix the problem.
=
is
=:=
In particular, look at slides Data Structures - 3 and 4 -- those define 'is'
and '=:=' pretty clearly. Slide Running Prolog - 7 defines '='. Slide Data
Structures - 6 shows many uses of the three predicates. Slide List
Processing - 9 has a use of '=' when defining the member() predicate, which
should provide you with another clue.
f(a). f(b). f(X).(Note the capital X.)
(or is "f( a (W) )" a composition?)
Answer:
Sorry, it's a composition. I should have used g or h rather than a.
Once again, the new due dates:
Questions 1 and 2: Tuesday evening, 6:10pm.
Question 3: Thursday evening, 6:10pm.
I will announce later how to turn in part 3.
In the meantime, you can read more about Horn Clauses here.
Please read all of them, because we will assume familiarity of those slides in class.
What I will do, so I don't penalize the people who are already done, is accept either version -- just indicate clearly whether you used Skolemization. Spread the word, please.
I encourage everyone to try to figure Skolemization out; it isn't difficult to do, and I will explain the intuition in class.
Here's a brief blurb:
You can eliminate the (there exist sign) by introducing a Skolem constant or
Skolem function. This can convert a non-horn into a horn clause.
(1) (exist y)friend(marsha, y) -- this is non-horn, but can be written as
friend(marsha, k) -- this is horn for some Skolem constant k
(2) (all x)[person(x) -> (exist y) friend(x,y)] (non-horn)can be written as
(all x)[person(x) -> friend(x,m(x))] (horn) where m is Skolem function
In (1) No dependency for y
In (2) y depends on x
Take a look at last fall's homework for more examples.
(setq boo 'cons)
Question:
a) you said we can use helper functions on any of the questions except #9.
b) 6B asks to replace a call to sum-list by a lambda expression.
c) What's stopping us from calling sum-list from the lambda expression? :)
Please do not call SUM-LIST (or any other helper function) from within the lambda expression, or use APPLY.
(Note to everyone: if you send me a question it really helps me if you take the time to make sure your question is both clear and grammatically correct. Please phrase your questions carefully.)
(load "filename")
(The quotes are necessary.)
:exit
(cons '1 ())
anwhere you want in the main buffer. Place the cursor anywhere within that
s-expr, and select Lisp-interaction/Evaluate this defun. You should see the
result in the minibuffer.