hey guys, I have created my own templated container class called Container to hold other class objects in my program.
My program has two classes:
1. Numbers
2. Letters
When the program runs the user enters a filename with the firstline being the class type (being a 1 for class type Numbers...
hey guys, I have created my own templated container class called Container to hold other class objects in my program.
My program has two classes:
1. Numbers
2. Letters
When the program runs the user enters a filename with the firstline being the class type (being a 1 for class type Numbers...
thanks for the reply,
so i figue the relation ship between X Y and Z is X = 0 -> Z = Y; Z = X; ??
a([X|L1],[Y|L2],[Z|L3]) :-
X = 0 -> Z = Y; Z = X;
a(L1,L2,L3).
when i use this it returns X = (1,_h173).
Im really sorry for bothering you, and i know i must be frustrating you because i cant...
ok, i now understand that you can only add things to the head of a list. I am confused in your example of why you would send just the tail (LZ) of the third list (Z) back to the function and not the whole list? here is what i understand:
1. work_a_list([X|Lx],[Y|Ly],Z) :-
2. X = 0,
3...
ok, thanks for the tips. i have been trying to do it for a single list like you suggested and this is what i have come up with.
work_a_list([],[],[]).
work_a_list([X|L1],[Y|L2],Z) :-
X = 0 -> work_a_list(L1,L2,[Z|X]); work_a_list(L1,L2,[Z|Y]).
where the first argument is the list [1,0,5]
and...
Hey, i am new to this forum so hope i am asking this question in the right spot, sorry if im not!
I just started prolog and am trying to understand lists.
say i have two lists of lists eg:
L1 = [[_,_,_],[_,_,_],[_,_,_].
L2 = [[1,0,5],[8,2,0],[0,0,9]].
how do i compare the two lists of lists...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.