Hi. Thanks by your answer. I'm using LPA and not SWI-Prolog. LPA doesn't have a predicate like predsort. However i implemented the follow code:
ordena2(L,LO):-findall(t(N,X),(member(X,L),liga2(X,N)),LL),
sort(LL,LLS),extrai_bs2(LLS,LO).
extrai_bs2([],[])...
Hi,
I'm trying to implement an algorithm in Prolog, in which I have a list L = [b1, b2, b3] and facts of the genre Liga2 (b1, 5), Liga2 (b2, 1), Liga2 (b3, 3). My aim is to sort the list L according to the argument of Liga2, getting as a result L = [b2, b3, b5].
Anyone can help me?
Thanks
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.