aboutsummaryrefslogtreecommitdiff
path: root/advent-of-code/2023/lib/obj.rkt
diff options
context:
space:
mode:
authorMistivia <i@mistivia.com>2024-02-17 12:27:24 +0800
committerMistivia <i@mistivia.com>2024-02-17 12:27:24 +0800
commit8fcd7e1ed30a8b04d4d658b2d8c6acad938424d4 (patch)
tree1cf064396cb0ddfdf77b2d3d6b56ebdd27c0ba9b /advent-of-code/2023/lib/obj.rkt
parent050fa7cbfb6b7cf293fb02e06daf123b3e6af816 (diff)
add aoc 2022
Diffstat (limited to 'advent-of-code/2023/lib/obj.rkt')
-rw-r--r--advent-of-code/2023/lib/obj.rkt32
1 files changed, 0 insertions, 32 deletions
diff --git a/advent-of-code/2023/lib/obj.rkt b/advent-of-code/2023/lib/obj.rkt
deleted file mode 100644
index 578ea36..0000000
--- a/advent-of-code/2023/lib/obj.rkt
+++ /dev/null
@@ -1,32 +0,0 @@
-#lang racket/base
-
-(provide obj-maker
- obj-set
- obj-show)
-
-(define (alist->obj alist)
- (lambda key
- (if (null? key)
- alist
- (cadr (assoc (car key) alist)))))
-
-(define (obj-maker . fields)
- (lambda inits
- (define alist (map list fields inits))
- (alist->obj alist)))
-
-(define (obj-set record key value)
- (define alist (record))
- (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))))))
- (alist->obj new-alist))
-
-(define (obj-show x) (x)) \ No newline at end of file