about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--rnd/sketch.rkt13
-rw-r--r--src/pokedex.rkt16
2 files changed, 16 insertions, 13 deletions
diff --git a/rnd/sketch.rkt b/rnd/sketch.rkt
new file mode 100644
index 0000000..dd25774
--- /dev/null
+++ b/rnd/sketch.rkt
@@ -0,0 +1,13 @@
+#lang racket
+
+;; place for notes and tests and sketches and all that jazz
+
+
+; 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))
\ No newline at end of file
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.