diff options
author | elioat <elioat@tilde.institute> | 2022-12-03 13:19:25 -0500 |
---|---|---|
committer | elioat <elioat@tilde.institute> | 2022-12-03 13:19:25 -0500 |
commit | 507d5b8606437b269f14c869beded7b87b9d0d9b (patch) | |
tree | 6574ffb0cdf18ee96ec2d3002a78ec23991fd483 /src | |
parent | 3e5ce69bce525725f2275ecf368e21d91a0b87f9 (diff) | |
download | december-2022-507d5b8606437b269f14c869beded7b87b9d0d9b.tar.gz |
saaaaaaaaaaaaaaand box
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. |