Drop gratuitous abstraction

This commit is contained in:
Lassi Kortela 2021-09-10 16:15:38 +03:00
parent 3fa52ef6e4
commit bc8504fc27
1 changed files with 5 additions and 8 deletions

View File

@ -1,18 +1,15 @@
(define (join-adjacent type? type-append list) (define (join-adjacent-strings list)
(let loop ((new-list '()) (list list)) (let loop ((new-list '()) (list list))
(if (null? list) (reverse new-list) (if (null? list) (reverse new-list)
(loop (if (and (not (null? new-list)) (loop (if (and (not (null? new-list))
(type? (car new-list)) (string? (car new-list))
(type? (car list))) (string? (car list)))
(cons (type-append (car new-list) (cons (string-append (car new-list)
(car list)) (car list))
(cdr new-list)) (cdr new-list))
(cons (car list) new-list)) (cons (car list) new-list))
(cdr list))))) (cdr list)))))
(define (join-adjacent-strings list)
(join-adjacent string? string-append list))
(define (vector-refs vec . indexes) (define (vector-refs vec . indexes)
(let loop ((obj vec) (indexes indexes)) (let loop ((obj vec) (indexes indexes))
(if (null? indexes) obj (if (null? indexes) obj