-
-
Save urbanslug/6271580b91a6b7bd45e1bbbfbc5caccb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; TODO: represent bases in binary | |
(serializable-struct | |
node* | |
(sequence id offset edges) | |
#:transparent) | |
;; adjacent-nodes is a set of edges out of the node | |
;; Should I replace UUID with a cryptographic hash of the sequence? | |
;; a negative offset means the offset for the node isn't yet determined | |
(define (node sequence [id (uuid-generate)] [offset -1] (adj (set))) | |
(node* sequence id offset adj)) | |
;; doesn't mutate the node | |
;; not allowed to change node id | |
;; if you want to do that remove the node and generate a new one? | |
;; What about all adjacent nodes? how do we update those? | |
;; how can we make this faster? | |
(define (update-node n #:sequence [seq false] #:offset [offset false] #:edges [edges false]) | |
(let ([s (or seq (node*-sequence n))] | |
[i (node*-id n) ] | |
[o (or offset (node*-offset n))] | |
[e (or edges (node*-edges n))]) | |
(node s i o e))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment