diff options
author | elioat <elioat@tilde.institute> | 2022-12-04 10:35:32 -0500 |
---|---|---|
committer | elioat <elioat@tilde.institute> | 2022-12-04 10:35:32 -0500 |
commit | 07127bdf5cb6a3e1b8c30d74b22d98c38622dd7f (patch) | |
tree | dd9465a4fa7f50c8b76ed18b60deff4f8fc56182 | |
parent | cc4b6f7c8a2b93632bd3dddd943bb3310a59d593 (diff) | |
download | december-2022-07127bdf5cb6a3e1b8c30d74b22d98c38622dd7f.tar.gz |
*
-rw-r--r-- | log.txt | 3 | ||||
-rw-r--r-- | src/tmp.rkt | 62 |
2 files changed, 33 insertions, 32 deletions
diff --git a/log.txt b/log.txt index 4a7685f..61db972 100644 --- a/log.txt +++ b/log.txt @@ -1,4 +1,5 @@ 30 NOV: Came up with the idea to do December Adventure, bootstrapped this repo 01 DEC: Played with vector sorting and summing in APL. Wrote function to fetch data from pokeapi, and return data as s-expression. Explored racket fmt utility 02 DEC: Added a function to grab only the data I'll need for the pokedex entry, and add it all to a hash table for later use -03 DEC: Going *deep* on how best to handle hash table data -- not lots of visible progress, but lots of noodling [late night addition -- cracked the nut!] \ No newline at end of file +03 DEC: Going *deep* on how best to handle hash table data -- not lots of visible progress, but lots of noodling [late night addition -- cracked the nut!] +04 DEC: \ No newline at end of file diff --git a/src/tmp.rkt b/src/tmp.rkt index f63055d..b46a1aa 100644 --- a/src/tmp.rkt +++ b/src/tmp.rkt @@ -3,32 +3,32 @@ ; (require sugar) (define test-data '#hash(("id" . 12) - ("name" . "butterfree") - ("sprite" . "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/12.png") - ("stats" - . (#hasheq((base_stat . 60) - (effort . 0) - (stat . #hasheq((name . "hp") (url . "https://pokeapi.co/api/v2/stat/1/")))) - #hasheq((base_stat . 45) - (effort . 0) - (stat . #hasheq((name . "attack") (url . "https://pokeapi.co/api/v2/stat/2/")))) - #hasheq((base_stat . 50) - (effort . 0) - (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/")))) - #hasheq((base_stat . 80) - (effort . 1) - (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/")))))) - ("types" - . (#hasheq((slot . 1) - (type . #hasheq((name . "bug") (url . "https://pokeapi.co/api/v2/type/7/")))) - #hasheq((slot . 2) - (type . #hasheq((name . "flying") (url . "https://pokeapi.co/api/v2/type/3/")))))))) + ("name" . "butterfree") + ("sprite" . "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/12.png") + ("stats" + . (#hasheq((base_stat . 60) + (effort . 0) + (stat . #hasheq((name . "hp") (url . "https://pokeapi.co/api/v2/stat/1/")))) + #hasheq((base_stat . 45) + (effort . 0) + (stat . #hasheq((name . "attack") (url . "https://pokeapi.co/api/v2/stat/2/")))) + #hasheq((base_stat . 50) + (effort . 0) + (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/")))) + #hasheq((base_stat . 80) + (effort . 1) + (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/")))))) + ("types" + . (#hasheq((slot . 1) + (type . #hasheq((name . "bug") (url . "https://pokeapi.co/api/v2/type/7/")))) + #hasheq((slot . 2) + (type . #hasheq((name . "flying") (url . "https://pokeapi.co/api/v2/type/3/")))))))) ; (define d (dict->list test-data)) ; or...you know...could convert from hash table to list? @@ -43,11 +43,11 @@ (define (inspector h) - (hash-map h - (lambda (k v) - (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) + (hash-map h + (lambda (k v) + (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) ;;(inspector test-data) |