summaryrefslogtreecommitdiffstats
path: root/sort.scm
diff options
context:
space:
mode:
Diffstat (limited to 'sort.scm')
-rwxr-xr-x[-rw-r--r--]sort.scm15
1 files changed, 7 insertions, 8 deletions
diff --git a/sort.scm b/sort.scm
index ab5f896..c06c834 100644..100755
--- a/sort.scm
+++ b/sort.scm
@@ -16,6 +16,7 @@
;;; jaffer: 2007-01-29: Final SRFI-95.
(require 'array)
+(require 'multiarg-apply) ; used in SORT
;;; (sorted? sequence less?)
;;; is true when sequence is a list (x0 x1 ... xm) or a vector #(x0 ... xm)
@@ -157,12 +158,11 @@
(define (sort! seq less? . opt-key)
(define key (if (null? opt-key) #f (car opt-key)))
(cond ((array? seq)
- (let ((dims (array-dimensions seq)))
- (do ((sorted (sort:sort-list! (rank-1-array->list seq) less? key)
- (cdr sorted))
- (i 0 (+ i 1)))
- ((null? sorted) seq)
- (array-set! seq (car sorted) i))))
+ (do ((sorted (sort:sort-list! (rank-1-array->list seq) less? key)
+ (cdr sorted))
+ (i 0 (+ i 1)))
+ ((null? sorted) seq)
+ (array-set! seq (car sorted) i)))
(else ; otherwise, assume it is a list
(let ((ret (sort:sort-list! seq less? key)))
(if (not (eq? ret seq))
@@ -184,8 +184,7 @@
(define (sort seq less? . opt-key)
(define key (if (null? opt-key) #f (car opt-key)))
(cond ((array? seq)
- (let ((dims (array-dimensions seq)))
- (define newra (apply make-array seq dims))
+ (let ((newra (apply make-array seq (array-dimensions seq))))
(do ((sorted (sort:sort-list! (rank-1-array->list seq) less? key)
(cdr sorted))
(i 0 (+ i 1)))