Assignments and Projects
Assignments and projects will be posted here.
- Assignment 1 is available here. This assignment is due on Tuesday, October 7, in the class. Solutions to the assignment are available here
- Project 1 description is available here. You will
need to download this file: unify_lterms.pl. The
project is due on Tuesday, November 4th, 5:30 pm. Project 1 FAQ:
- Q: Are we allowed to declare extra predicates besides the ones that are required in
the project?
A: Yes. - Q: How to make Prolog display lists in full (i.e. without ...) ?
A: Type the following at Prolog prompt:?- set_prolog_flag(toplevel_print_options, [quoted(true), portray(true), max_depth(0)]). :- set_prolog_flag(toplevel_print_options, [quoted(true), portray(true), max_depth(0)]). - Q: in apply_subst([V/T],...) how to "parse out" V and T ?
A: As far as Prolog is concerned / is just a name of the atom (operator, to be exact), so all you need to do is to declare you predicate like this:apply_subst([V/T], T1, T2) :- some code that uses V and T here. aaa([V/T]) :- write('V is '), write(V), nl, write('T is '), write(T), nl. ?- aaa(['X'/[f, 'Y']]).
- Q: Are we allowed to declare extra predicates besides the ones that are required in
the project?
- Assignment 2 is available here. This assignment is due on Thursday, February 19, 11:59 pm.
- My solutions to Assignment 2 are here: stream.ml, append.ml.