Sorting algorithms/Insertion sort: Difference between revisions

no edit summary
(→‎{{header|Ruby}}: Added an alternative implementation.)
No edit summary
Line 19:
 
Writing the algorithm for integers will suffice.
 
=={{header|ACL2}}==
<lang Lisp>(defun insert (x xs)
(cond ((endp xs) (list x))
((< x (first xs))
(cons x xs))
(t (cons (first xs)
(insert x (rest xs))))))
 
(defun isort (xs)
(if (endp xs)
nil
(insert (first xs)
(isort (rest xs)))))</lang>
 
=={{header|ActionScript}}==
Anonymous user