diff options
author | elioat <elioat@tilde.institute> | 2022-12-03 14:15:30 -0500 |
---|---|---|
committer | elioat <elioat@tilde.institute> | 2022-12-03 14:15:30 -0500 |
commit | e2e78c037ad9fa5429b5aaa13a454f647f9c9416 (patch) | |
tree | 1868b4e238686c93796f2e0242068c662abf1dd6 | |
parent | 8214ad9ba7bc27cfd1a017f6f93ba972e5661603 (diff) | |
download | december-2022-e2e78c037ad9fa5429b5aaa13a454f647f9c9416.tar.gz |
sample project
-rw-r--r-- | src/tmp.rkt | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/tmp.rkt b/src/tmp.rkt index c8bcbbb..def2ea0 100644 --- a/src/tmp.rkt +++ b/src/tmp.rkt @@ -1,4 +1,6 @@ -'#hash(("id" . 12) +#lang racket + +(define test-data '#hash(("id" . 12) ("name" . "butterfree") ("sprite" . "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/12.png") ("stats" @@ -26,4 +28,19 @@ . (#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/"))))))) \ No newline at end of file + (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 ", value: " v "\n"))))) + +(define (inspector2 h) + (hash-map h + (lambda (k v) + (if (hash? v) (~a "value " v " was a hash table!\n") + (display (~a "key: " k ", value: " v "\n")))))) + +; (inspector1 test-data) +(inspector2 test-data) \ No newline at end of file |