diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/pokedex.rkt | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/pokedex.rkt b/src/pokedex.rkt index 89fd7ea..cc48fba 100644 --- a/src/pokedex.rkt +++ b/src/pokedex.rkt @@ -43,23 +43,13 @@ ;; TOMORROW I'll start to figure out how to present this data (define (inspector h) - "display the contents of a hash table for human eyeballs" + "display the contents of a hash table for human eyeballs and let the hash table fall back out" (hash-map h (lambda (k v) - (if (hash? v) (inspector v) ;; test if value is a hash table, if so recursively apply inspector (I don't think this is working right) - (display (~a "key: " k ", value: " v "\n"))))) ; QUESTION: is there a functional difference between hash-map and hash-for-each here? + (display (~a "key: " k ", value: " v "\n")))) ; QUESTION: is there a functional difference between hash-map and hash-for-each here? h) -; the sketch of how maybe to access these nested hash tables (this has become hillariously difficult to solve) -; (define path '(some deep key)) -> - -; (for/fold ((ht deep-hash-table)) -; ((key (in-list path)) -; #:break -; (not (hash? ht))) -; (hash-ref ht key)) - -(hash-ref (inspector (dex-entry 5)) "types") ;; struggling to figure out how to access the nested hash tables stats and types... +(hash-ref (dex-entry 5) "types") ;; struggling to figure out how to access the nested hash tables stats and types... ;; the other option not yet considered is to make individual API calls for each bit of data, rather than 1 call and plucking out the data I want. ;; this may lead to an easier data shape, but means a lot more network traffic. |