badkarma082
IS-IT--Management
I must develop a function that will accept 3 arguments.
The first two arguments must be a lists.
When either argument is not a list, join_alternate shall display an error message and terminate its processing.
When both arguments are lists, then alternate will produce a new list as its result, as follows:
?- alternate([1,2,3], [a,b,c], R)
R = [1,a,2,b,3,c]
?- alternate([1,2], [a,b,c], R)
R = [1,a,2,b,c]
?- alternate([1], [a,b,c], R)
R = [1,a,b,c]
I would appreciate any help. I just cant figure it out thanks!
The first two arguments must be a lists.
When either argument is not a list, join_alternate shall display an error message and terminate its processing.
When both arguments are lists, then alternate will produce a new list as its result, as follows:
?- alternate([1,2,3], [a,b,c], R)
R = [1,a,2,b,3,c]
?- alternate([1,2], [a,b,c], R)
R = [1,a,2,b,c]
?- alternate([1], [a,b,c], R)
R = [1,a,b,c]
I would appreciate any help. I just cant figure it out thanks!