From 32fb1697d4aa5df000df16bd207fa82bfb72b7be Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Fri, 14 Aug 2020 17:01:59 -0400 Subject: [PATCH] Fix list-range to not blow up when out of range --- src/pollen.rkt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pollen.rkt b/src/pollen.rkt index 79f1264..317a734 100644 --- a/src/pollen.rkt +++ b/src/pollen.rkt @@ -9,7 +9,10 @@ (provide (all-defined-out)) (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) (get-source (path->string (path->complete-path (symbol->string post)))))