; dicts (func dict? (val) (and (list? val) ; TODO should this be automatic? (or (eq? 0 (list-length val)) (and (eq? 1 (list-length val)) (list? (first val))) (apply and (map list? val))) (eq? 0 (list-length (filter (lambda (x) (not (eq? x 2))) (map list-length val)))))) (type :dict :list dict?) (func dict () (list)) (func has? (in :dict key) (not (empty? (filter (lambda (x) (eq? (first x) key)) in)))) (func get (d :dict key) (first (rest (first (filter (lambda (x) (eq? (first x) key)) d))))) (func set (d :dict key val) (if (has? d key) (map (lambda (x) (if (eq? key (first x)) (list (first x) val) x)) d) (append d (list key val)))) (func keys (d :dict) (map first d)) (func drop (d :dict key) (filter (lambda (x) (not (eq? (first x) key))) d))