i want append 1 list element in nested list:
predicates append(li,li,li). clauses append([x|y],z,[x|w]):- append(y,z,w). append([],x,x).
for example:
append([ [1],[2],[3] ],[4],a) solution: = [ [1],[2],[3],[4] ]
turbo prolog said: type error.
how can this?
the problem defining domains wrong, , appending 2 different domains (a list of list of integers list of integers).
if want append lists of lists of integers (as seems example) code should be
domains li = integer* lili = li* predicates append(lili, lili, lili). clauses append([x|y],z,[x|w]):- append(y,z,w). append([],x,x).
and in example second list should list of lists two, yielding:
append([ [1],[2],[3] ],[[4]],a). solution: = [ [1],[2],[3],[4] ]
note second list [[4]] instead of [4].
Comments
Post a Comment