Skip to content

Instantly share code, notes, and snippets.

@vu3rdd
Created July 10, 2011 16:20
Show Gist options
  • Select an option

  • Save vu3rdd/1074658 to your computer and use it in GitHub Desktop.

Select an option

Save vu3rdd/1074658 to your computer and use it in GitHub Desktop.
update a deeply nested hash table in Racket
(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