diff --git a/scheme/select-list.scm b/scheme/select-list.scm index 984dd9f..9dd061f 100644 --- a/scheme/select-list.scm +++ b/scheme/select-list.scm @@ -10,9 +10,12 @@ (lambda (r) `(element ,(element-marked? r) ,(element-text r)))) -(define (make-unmarked-element markable? value text) +(define (make-unmarked-element value markable? text) (make-element markable? #f value text)) +(define (make-marked-element value markable? text) + (make-element markable? #t value text)) + (define-record-type select-list :select-list (really-make-select-list elements view-index cursor-index num-lines) select-list? @@ -27,12 +30,10 @@ (view-index ,(select-list-view-index r)) (num-lines ,(select-list-num-lines r))))) -(define (make-select-list value/markable/text-tuples num-lines) - (really-make-select-list - (map (lambda (value/markable/text) - (apply make-unmarked-element value/markable/text)) - value/markable/text-tuples) - 0 0 num-lines)) +(define (make-select-list elements num-lines) + (if (and (proper-list? elements) (every element? elements)) + (really-make-select-list elements 0 0 num-lines) + (error "wrong argument type" elements))) (define key-m 109) @@ -63,6 +64,7 @@ (let ((el (car element.i)) (i (cadr element.i))) (cons (make-element + (element-markable? el) (if (and (element-markable? el) (= index i)) mark