about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/tmp.rkt27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/tmp.rkt b/src/tmp.rkt
index b10d3b1..c90ea89 100644
--- a/src/tmp.rkt
+++ b/src/tmp.rkt
@@ -15,12 +15,10 @@
                    (stat . #hasheq((name . "defense") (url . "https://pokeapi.co/api/v2/stat/3/"))))
            #hasheq((base_stat . 90)
                    (effort . 2)
-                   (stat . #hasheq((name . "special-attack")
-                                   (url . "https://pokeapi.co/api/v2/stat/4/"))))
+                   (stat . #hasheq((name . "special-attack") (url . "https://pokeapi.co/api/v2/stat/4/"))))
            #hasheq((base_stat . 80)
                    (effort . 1)
-                   (stat . #hasheq((name . "special-defense")
-                                   (url . "https://pokeapi.co/api/v2/stat/5/"))))
+                   (stat . #hasheq((name . "special-defense") (url . "https://pokeapi.co/api/v2/stat/5/"))))
            #hasheq((base_stat . 70)
                    (effort . 0)
                    (stat . #hasheq((name . "speed") (url . "https://pokeapi.co/api/v2/stat/6/"))))))
@@ -31,18 +29,21 @@
                    (type . #hasheq((name . "flying") (url . "https://pokeapi.co/api/v2/type/3/"))))))))
 
 
-(define (inspector1 h)
-    (hash-map h
-        (lambda (k v)
-                (display (~a "  key: " k "\nvalue: " v "\n=====\n"))))
-    h)
+; (hash? (car (hash-ref test-data "stats"))) ; #t --- BOOM! this gets us a hash table! 
+; (display (car (hash-ref test-data "stats")))
+; (list? (hash-ref test-data "stats")) ;; #t
 
-(define (inspector2 h)
+;; "stats" and "types" AREN'T exactly nested hash tables! They're lists, with hash tables embedded in them! 
+;; SO! I need a way to test for if something is a LIST, and then if it is a LIST I think then I hash map through that!
+
+
+(define (inspector h)
     (hash-map h
         (lambda (k v)
-                (if (hash? v) (~a "value " v " was a hash table!\n")
+                (if (list? v) (display (~a "HARK! THE VALUE FOR THE KEY ~"k"~ IS A LIST \n====\n"))
                         (display (~a "  key: " k "\nvalue: " v "\n=====\n")))))
     h)
 
-; (inspector1 test-data)
-(inspector2 test-data)
\ No newline at end of file
+(inspector test-data)
+
+;; NEXT STEPS -> https://stackoverflow.com/questions/13504302/racket-scheme-filtering
\ No newline at end of file