News for hackers. Stuff that matters.
Re:I want to fix programming by daviddaviddavid on Tuesday January 24, 2012 @09:10PM (#3508058)
Here's a Prolog implementation of bubblesort (taken from Bratko's Prolog Programming for AI).

  bubblesort(List, Sorted) :-
      swap(List, List1), !,
      bubblesort(List1, Sorted).

  swap([X,Y|Rest], [Y,X|Rest) :-
      gt(X,Y).
  swap([Z|Rest], [Z|Rest1]) :-
      swap(Rest, Rest1).

There are no comments on this comment yet.