Jump to content
xisto Community

Monbasstic

Members
  • Content Count

    1
  • Joined

  • Last visited

  1. Hi Anduril I try to undestand what are you doing with the predicate "cridaappend"It is involved inside the calcul of the regionsreg(LI,N,LF):-regions(LI,N,Z),col(Z,P),creasubreg(P,N,L),cridaappend(L,Q),aplana(Q,LF).I have noted tha cridaappend works fine when is called whit a even number of elementsinto L ...% ?-cridaappend([[[1,2],[3,4]], [[5,6],[7,8]] ],Q)% Q = [[[1, 2], [3, 4], [5, 6], [7, 8]]]% ?-cridaappend([[[11,12],[13,14],[15,16]], [[21,22],[23,24]] ],Q)% Q = [[[11, 12], [13, 14], [15, 16], [21, 22], [23, 24]]]% ?-cridaappend([ [1],[2],[3],[4],[5],[6] ],Q)% Q = [[1, 2], [3, 4], [5, 6]]% ?-cridaappend([ [11,12],[21,22],[31,32],[41,42],[51,52],[61,62] ],Q)% Q = [[11, 12, 21, 22], [31, 32, 41, 42], [51, 52, 61, 62]]but, it fails when L is a list with a odd number of elements% ?-cridaappend([ [1],[2],[3],[4],[5]],Q)% Failurealso, the list returned by the previous procedure "creasubreg(P,N,L)" gives in La odd number of elements like (for example).. L = [ [ [11, 12, 13, 21, 22, 23, 31, 32, 33], [41, 42, 43, 51, 52, 53, 61, 62, 63], [71, 72, 73, 81, 82, 83, 91, 92, 93] ], [ [14, 15, 16, 24, 25, 26, 34, 35, 36], [44, 45, 46, 54, 55, 56, 64, 65, 66], [74, 75, 76, 84, 85, 86, 94, 95, 96] ], [ [17, 18, 19, 27, 28, 29, 37, 38, 39], [47, 48, 49, 57, 58, 59, 67, 68, 69], [77, 78, 79, 87, 88, 89, 97, 98, 99] ] ]Then, when we call latter "cridaappend", the algoritm fails.Can you explain me how you implements the predicate "append" , i suposeit is implemented as: append([],L,L). append([X|L1],L2,[X|L12]):- append(L1,L2,L12).thanks in advanceMon
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.