; dicts (func dict () (list)) (func dict? (in) (def flag #true) (for-each in (if (not (eq? (list-length _item_) 2)) (redef flag #false))) flag) (func has? (in key) (def has #false) (for-each in (if (eq? (first _item_) key ) (redef has #true))) has) (func get (d key) (if (and (dict? d) (has? d key)) (block (def val 0) (for-each d (if (eq? (first _item_) key) (redef val (first (rest _item_))))) val) ; we should panic here )) (func set (d key val) (if (dict? d) (block (def out (dict)) (for-each d (if (eq? (first _item_) key) (redef out (append out (list key val))) (redef out (append out _item_)))) (if (not (has? out key)) (redef out (append out (list key val)))) out) ; we should panic here )) (func keys (d) (map first d)) (func drop (d key) (if (dict? d) (block (def out (dict)) (for-each d (if (not (eq? (first _item_) key)) (redef out (append out _item_)))) out) ; we should panic here ))