Q:

Carrying state/IO through a chain of functions in Clojure to be used later in the chain

I've got a bit of a functional question.
If I have a functional chain where I compose functions in a way that the output of the previous is the input of the next one. 
And somewhere down that chain, I need stuff to do IO, like a client to a DB, etc.
What would be a Clojure way that feels functional to do it?
=========
To explain it more clearly,
(let [map {:aThing "I'm a"}]
(->> (a->b map)
     (b->c)
     (c->d)
     (d->e)))

(a->b) converts :aThing into :bThing
(b->c) converts :bThing into :cThing but it needs something that can AES decrypt to do so.
(c->d) converts :cThing into :dThing but it does so by fetching things from a database, and thus requires a database username/pasword, endpoint, connection, etc.
(d->e) converts :dThing into :eThing and returns it.
The chain is complete.

In Clojure, what would be proper way to allow this chain to work?

A:

If a tree falls in the woods, does it make a sound?
If a pure function mutates some local data in order to produce an immutable return value, is that ok? -- Rich Hickey
I say Davyzhu is right.
The way I'd approach it is this:
(def conn-opts {:user :name
                :password :pass
                ;any other params})

(defn c->d [conn-opts map]
 (let [db (connect conn-opts)]
      ;return the result of applying the transformation 
      ;on the map and the db.
     (fn-do map db))

(defn job [map]
 (->> map
      (a->b)
      (b->c)
      (c->d conn-opts)
      (d->e)))

