I'm working on a case-based reasoning subsystem for academic advising that is able to take a new student profile (transcript) and compare it to database of student_profiles in order to find the best match if not the exact match.
I'm still not very familiar with the language and I trying to open a file and extract an specific predicate let's say
student_profile/4 : student_profile(L1, name, L2, L3)
which is found in student.pl.
Once I have extracted the predicate from the .pl file, I want to be
able to assign it to a variable and split it
so I can extract the first argument (in this case L1) to
make some calculations.
This is what I have so far:
I have opened the file and I'm able to see the entire list of predicates
found in the student profile or transcript.
load :- open('h:/AAS/Novel_Profiles/vivian.pl', read, Stream),
read(Stream, X),
read_data(Stream, X, StudentP),
write(StudentP),
close(Stream).
read_data(_Stream, end_of_file, []) :- !.
read_data(Stream, X, [X|StudentP]) :-
read(Stream, Y),
read_data(Stream, Y, StudentP).
I have looked for examples on how to extract a term and use it for further processing but I have had no luck (or maybe I'm not using the right terminology).