about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorelioat <elioat@tilde.institute>2022-12-03 21:37:22 -0500
committerelioat <elioat@tilde.institute>2022-12-03 21:37:22 -0500
commitf1114555344d85ce05f891d6e352f7075d04b147 (patch)
treeb33aee4687ca5552275b9a3e03d0ae3d80753201
parentee5ebcb9b97b1ff0659098b97227fc7e40f38de7 (diff)
downloaddecember-2022-f1114555344d85ce05f891d6e352f7075d04b147.tar.gz
I think I actually maybe have a way forward!
-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