From e2e78c037ad9fa5429b5aaa13a454f647f9c9416 Mon Sep 17 00:00:00 2001 From: elioat Date: Sat, 3 Dec 2022 14:15:30 -0500 Subject: sample project --- src/tmp.rkt | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src') 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 -- cgit 1.4.1-2-gfad0