(defun median (arr) (if (vectorp arr) (let* ( (len (length arr)) (mid (floor (/ len 2))) (sorted (quicksort arr 0 (- (length arr) 1)))) (svref sorted mid))))