Skip to content

Instantly share code, notes, and snippets.

@jboynyc
Created August 12, 2018 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jboynyc/42748d6001e3433fa223f074cc053607 to your computer and use it in GitHub Desktop.
Save jboynyc/42748d6001e3433fa223f074cc053607 to your computer and use it in GitHub Desktop.
`get-in` for racket
#lang racket
(define (get-in h . path)
(foldl (λ (p h) (hash-ref h p)) h path))
(define nested-dict #hash((foo .
#hash((bar .
#hash((spam .
#hash((eggs . 1)))))))))
(get-in nested-dict 'foo 'bar 'spam 'eggs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment