diff options
Diffstat (limited to 'advent-of-code/lib/utils.rkt')
| -rw-r--r-- | advent-of-code/lib/utils.rkt | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/advent-of-code/lib/utils.rkt b/advent-of-code/lib/utils.rkt index 42b36af..2ce8a51 100644 --- a/advent-of-code/lib/utils.rkt +++ b/advent-of-code/lib/utils.rkt @@ -8,21 +8,21 @@ (define (repeat n e) (let loop ((i 0) (ret '())) (if (>= i n) - ret - (loop (+ 1 i) (cons e ret))))) + ret + (loop (+ 1 i) (cons e ret))))) (define (get-lines fp) (let loop ((lines '())) (define l (read-line fp)) (if (eof-object? l) - (reverse lines) - (loop (cons l lines))))) + (reverse lines) + (loop (cons l lines))))) (define (enumerate lst) (let loop ((i 1) (ret '()) (remain lst)) (if (null? remain) - (reverse ret) - (loop (+ 1 i) (cons (list (car remain) i) ret) (cdr remain))))) + (reverse ret) + (loop (+ 1 i) (cons (list (car remain) i) ret) (cdr remain))))) (define (split-list-by e lst . eq) (define cmp (if (null? eq) equal? eq)) @@ -30,7 +30,7 @@ (cur '()) (lst lst)) (if (null? lst) - (reverse (cons (reverse cur) ret)) - (if (cmp e (car lst)) - (loop (cons (reverse cur) ret) '() (cdr lst)) - (loop ret (cons (car lst) cur) (cdr lst))))))
\ No newline at end of file + (reverse (cons (reverse cur) ret)) + (if (cmp e (car lst)) + (loop (cons (reverse cur) ret) '() (cdr lst)) + (loop ret (cons (car lst) cur) (cdr lst)))))) |
