;;AUTOLOAD: dosort
;;AUTODOC: dosort "simplified form to sort a list"
;; (dosort (variable1 variable2 list) forms...)
;;
;; dosort is to sort what is dolist to map.
;; dosort sorts in place the list in increasing order, according to the
;; comparison forms, the last one having to return an 
;; integer. Its value will be negative, null or positive if the first 
;; argument is respectively less than, equal to, or greater than the 
;; second.
;; See the sort function.
;;
;; Example:
;; (dosort (n1 n2 '( "BCD" "Efg" "abc" "ghi"))
;;   (if (< (toupper n1) (toupper n2)) -1
;;     (if (= (toupper n1) (toupper n2)) 0 1)))

(defmacrod dosort (varlist &rest forms)
  (if (not (and
	(typep varlist List)
	(= (length varlist) 3)
	(typep (0 varlist) Atom)
	(typep (1 varlist) Atom)
    ))
    (error 'Errors:BadDoSyntax)

    `(sort ,(2 varlist)
      (lambda (,(0 varlist) ,(1 varlist)) ,@forms)
)))
