Created
July 10, 2011 16:20
-
-
Save vu3rdd/1074658 to your computer and use it in GitHub Desktop.
update a deeply nested hash table in Racket
This file contains hidden or 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
| (define (hash-set-in ht ks v) | |
| (cond [(not (list? ks)) (error "ks not a list")] | |
| [(empty? (cdr ks)) (hash-set ht (car ks) v)] | |
| [else | |
| (hash-set ht | |
| (car ks) | |
| (hash-set-in (hash-ref ht (car ks)) | |
| (cdr ks) | |
| v))])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment