Apr 26, 2016 03:00 AM
(This post was last modified: Apr 26, 2016 03:01 AM by Marilyn Manson.)
Hey guys.
I apologize for the lack of information I'm going to write in this post (it's an assignment and I'm paranoid that my full code will be linked back to me.
Essentially what my .pl is doing is reading from a .data file and it then parses the information and applys simple text modification to make it prolog standard (i.e capital letters are changed to lower case) and then it adds it as a rule using a function similar to this fridge(X, D, A, S).
I know that the recursion works correctly as intended as it goes through the entire file and prints out the information but when I attempt to use the function fridge(X, D, A, S) and add that particular fridge, the program stops after the first attempt to add that particular fridge in the database.
Here's a section of the code that attempts to add the fridge if that shows a little more light on whats happening:
It'll attempt to add the fridge, but when checking if it's in the database it'll return false and not return the entire contents of the file like it usually does when the fridge() command is commented out.
I hope that you're able to understand what I mean.
[/code]
I've also got to produce a query that returns the lowest litre fridge first, google wasn't able to help me (atleast with the top 3 searches anyway and the rest were unrelated).
Cheers guys, posts or PMs are appreciated.
I apologize for the lack of information I'm going to write in this post (it's an assignment and I'm paranoid that my full code will be linked back to me.
Essentially what my .pl is doing is reading from a .data file and it then parses the information and applys simple text modification to make it prolog standard (i.e capital letters are changed to lower case) and then it adds it as a rule using a function similar to this fridge(X, D, A, S).
I know that the recursion works correctly as intended as it goes through the entire file and prints out the information but when I attempt to use the function fridge(X, D, A, S) and add that particular fridge, the program stops after the first attempt to add that particular fridge in the database.
Here's a section of the code that attempts to add the fridge if that shows a little more light on whats happening:
Code
add_fridge([Model, Serial, Litre, Weight]) :-
write(Model),
write(Serial),
write(Litre),
write(Weight),
fridge(Model, Serial, Litre, Weight).It'll attempt to add the fridge, but when checking if it's in the database it'll return false and not return the entire contents of the file like it usually does when the fridge() command is commented out.
I hope that you're able to understand what I mean.
[/code]
I've also got to produce a query that returns the lowest litre fridge first, google wasn't able to help me (atleast with the top 3 searches anyway and the rest were unrelated).
Cheers guys, posts or PMs are appreciated.

