about summary refs log tree commit diff stats
path: root/layout.c
#lang racket

; (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/"))))))))


; (define d (dict->list test-data)) ; or...you know...could convert from hash table to list?


; (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

;; "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 (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)

;; NEXT STEPS -> https://stackoverflow.com/questions/13504302/racket-scheme-filtering


(displayln (hash-ref (car (hash-ref test-data "stats")) 'base_stat)) ;; just show the specific stat
(displayln (car (hash-ref test-data "stats"))) ;; show tne entire hash table!
Commit message (Collapse)AuthorAgeFilesLines
* added screen.c, removed layout.c and tag.cAnselm R. Garbe2007-08-191-219/+0
|
* prepared merging layout.c and tag.c into screen.cAnselm R. Garbe2007-08-191-13/+4
|
* small fixAnselm R. Garbe2007-08-191-1/+1
|
* hmm I doubt the usefulness of storing this information...Anselm R. Garbe2007-08-181-0/+40
|
* cleaned up settags-handlingAnselm R. Garbe2007-08-181-9/+9
|
* replaced static Layout *lt with static unsigned int sellayout... (will be ↵Anselm R. Garbe2007-08-171-13/+12
| | | | adapted later when _DWM_CONFIG is serialized as root window property)
* made plural arraysAnselm R. Garbe2007-08-161-6/+6
|
* made tag/view/toggle{tag,view} work on pointer to tags-array, there was the ↵Anselm R. Garbe2007-08-161-13/+21
| | | | need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
* tags should be persistent now during X server runAnselm R. Garbe2007-08-131-3/+3
|
* made Layout a static struct in layout.c, added some convenience getters in ↵Anselm R. Garbe2007-08-131-10/+37
| | | | layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
* moved floating to layout.c, kept tile.c outsideAnselm R. Garbe2007-08-121-0/+37
|
* separated layout-specific stuff into separate .h and .c files which are ↵Anselm R. Garbe2007-08-111-114/+2
| | | | included in config.h resp. config.mk - this allows writing layouts for dwm without any need to patch existing code
* let not overlap the bordersAnselm R. Garbe2007-08-101-1/+1
|
* removed VRATIO, NMASTER, inc*(), renamed HRATIO into MASTER, see mailinglist ↵Anselm R. Garbe2007-08-101-148/+66
| | | | for details
* removed spow(x, 0); calls, I did them for consistency's sake, but it should ↵Anselm R. Garbe2007-08-051-3/+3
| | | | be rather obvious how the scaling works anyways
* changed shortcuts as described on the mailinglist, added sanity checks for ↵Anselm R. Garbe2007-08-051-18/+35
| | | | ratios during tile (fallback to wah if clients would get too small), documented that new stuff/shortcuts in dwm(1)
* small fix of static function orderAnselm R. Garbe2007-08-041-18/+18
|
* I introduced {H,V}RATIO and inc{h,v,}ratio() functions - the default behaves ↵Anselm R. Garbe2007-08-041-21/+32
| | | | like in dwm-4.3, config.arg.h shows how I prefer the ratio being handled (for the future I plan to change const char *arg into ..., and renaming Client into Win.)
* removed a C++ style commentAnselm R. Garbe2007-08-031-1/+1
|
* implemented ratio tile as described on the mailinglistAnselm R. Garbe2007-08-031-33/+61
|
* applied restack patch of anydot, with slight changesAnselm R. Garbe2007-06-061-3/+9
|
* added an creatnotify event handlerAnselm R. Garbe2007-06-041-16/+0
|
* applied anudots [un]ban repair patchAnselm R. Garbe2007-06-041-3/+1
|
* replaced BORDERPX with sel->border in togglemax(), in other places this is ↵Anselm R. Garbe2007-05-301-1/+1
| | | | not possible.
* referred to LICENSE file 4.2Anselm R. Garbe2007-05-301-6/+1
|
* Jukka also belongs to Copyright holders after all he has contributed and ↵Anselm R. Garbe2007-05-301-0/+1
| | | | done for dwm, updated -v as well
* added nsz to copyright holders as well, because he did a lot recentlyAnselm R. Garbe2007-05-291-0/+1
|
* added anydot to Copyright holders, because he contributed a lot recentlyAnselm R. Garbe2007-05-291-0/+1
|