diff options
| author | Mistivia <i@mistivia.com> | 2024-02-20 00:42:16 +0800 |
|---|---|---|
| committer | Mistivia <i@mistivia.com> | 2024-02-20 00:42:16 +0800 |
| commit | bebb8946d29069b2acb10db71c8c9203ed4ae922 (patch) | |
| tree | 66ee2e321cbb413baaf32661195f2c734546eba0 /advent-of-code/lib/utils.rkt | |
| parent | 3a4e5447a79096d813cdaf4498b9a1e2c086b7ff (diff) | |
λ looks cool & format code
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)))))) |
