
(let (

    foldl (let (helper (rec-lambda recurse (f z vs i) (if (= i (len (idx vs 0))) z
                                                                       (recurse f (lapply f (cons z (map (lambda (x) (idx x i)) vs))) vs (+ i 1)))))
               (lambda (f z & vs) (helper f z vs 0)))
    foldr (let (helper (rec-lambda recurse (f z vs i) (if (= i (len (idx vs 0))) z
                                                                       (lapply f (cons (recurse f z vs (+ i 1)) (map (lambda (x) (idx x i)) vs))))))
               (lambda (f z & vs) (helper f z vs 0)))
    reverse (lambda (x) (foldl (lambda (acc i) (cons i acc)) [] x))
    zip (lambda (& xs) (lapply foldr (concat [(lambda (a & ys) (cons ys a)) []] xs)))
    empty_dict []
    put (lambda (m k v) (cons [k v] m))
    get-value-helper (rec-lambda recurse (dict key i) (if (>= i (len dict))
                                                    (error (str key " not found in " dict))
                                                    (if (= key (idx (idx dict i) 0))
                                                        (idx (idx dict i) 1)
                                                        (recurse dict key (+ i 1)))))
    get-value (lambda (dict key) (get-value-helper dict key 0))
    add-dict-to-env (let (helper (rec-lambda recurse (env dict i)
                                (if (= i (len dict)) env
                                                    (recurse (eval [ [vau '_ [(idx (idx dict i) 0)] [ [vau 'inner [] 'inner] ] ] (idx (idx dict i) 1) ] env) dict (+ i 1)))))
                      (lambda (env dict) (helper env dict 0)))
)
    (provide foldl foldr reverse zip empty_dict put get-value add-dict-to-env)
)

