Fix list-range to not blow up when out of range

This commit is contained in:
Jeremy Dormitzer 2020-08-14 17:01:59 -04:00
parent ea225293e6
commit 32fb1697d4

View File

@ -9,7 +9,10 @@
(provide (all-defined-out)) (provide (all-defined-out))
(define (list-range lst start end) (define (list-range lst start end)
(take (drop lst start) (- end start))) (let ((dropped (drop lst start)))
(if (>= (length dropped) (- end start))
(take dropped (- end start))
dropped)))
(define (post->source post) (define (post->source post)
(get-source (path->string (path->complete-path (symbol->string post))))) (get-source (path->string (path->complete-path (symbol->string post)))))