Anonymous user
Sorting algorithms/Bubble sort: Difference between revisions
no edit summary
(added common lisp code) |
No edit summary |
||
Line 345:
Bubble sort an sequence in-place, using the < operator for comparison if no comaprison function is provided
<lang lisp>(defun bubble-sort( sequence &optional( compare #'<))
"sort a sequence (array or list) with an optional comparison function (< is the default)"
(loop with sorted = nil while (not sorted) do
Line 357:
(bubble-sort (list 5 4 3 2 1))
</lang>
=={{header|D}}==
|