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/obj.rkt | |
| parent | 3a4e5447a79096d813cdaf4498b9a1e2c086b7ff (diff) | |
λ looks cool & format code
Diffstat (limited to 'advent-of-code/lib/obj.rkt')
| -rw-r--r-- | advent-of-code/lib/obj.rkt | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/advent-of-code/lib/obj.rkt b/advent-of-code/lib/obj.rkt index 9217976..8ffc401 100644 --- a/advent-of-code/lib/obj.rkt +++ b/advent-of-code/lib/obj.rkt @@ -5,13 +5,13 @@ obj-show) (define (alist->obj alist) - (lambda key + (λ key (if (null? key) - alist - (cadr (assoc (car key) alist))))) + alist + (cadr (assoc (car key) alist))))) (define (obj-maker . fields) - (lambda inits + (λ inits (define alist (map list fields inits)) (alist->obj alist))) @@ -20,13 +20,13 @@ (define new-alist (let loop ((new-list '()) (cur alist) (is-set #f)) (if (null? cur) - (if is-set - new-list - (cons (list key value) new-list)) - (let () - (if (eq? key (caar cur)) - (loop (cons (list key value) new-list) (cdr cur) #t) - (loop (cons (car cur) new-list) (cdr cur) is-set)))))) + (if is-set + new-list + (cons (list key value) new-list)) + (let () + (if (eq? key (caar cur)) + (loop (cons (list key value) new-list) (cdr cur) #t) + (loop (cons (car cur) new-list) (cdr cur) is-set)))))) (alist->obj new-alist)) (define (obj-show x) (x))
\ No newline at end of file |
