TITLE: About the category of all small diagrams
QUESTION [8 upvotes]: Let $\mathcal{K}$ be a category. I denote by $\mathcal{D}\mathcal{K}$ the category of all small diagrams over $\mathcal{K}$: an object is a functor $F:I\to \mathcal{K}$ from a small category $I$ to $\mathcal{K}$ and a morphism from $F:I\to \mathcal{K}$ to $G:J\to \mathcal{K}$ is a functor $\phi:I\to J$ together with a natural transformation $\mu:F\Rightarrow G\circ \phi$. If $\mathcal{K}$ is complete and cocomplete, then $\mathcal{D}\mathcal{K}$ is complete and cocomplete as well. I have two basic questions about $\mathcal{D}\mathcal{K}$:

When $\mathcal{K}$ is cartesian closed, is $\mathcal{D}\mathcal{K}$ cartesian closed ?
Does it exist any paper/book gathering what is known about this category which is certainly not new ? In particular, does this construction have a name ?

REPLY [5 votes]: If $\mathcal{K}$ is assumed both complete and cartesian closed, then $\mathcal{DK}$ is also complete and cartesian closed. Since completeness is not in question for the OP, I'll skip over that part and focus on cartesian closure, although we will need to recall the structure of finite cartesian products. 
So: if $g: J \to \mathcal{K}$ and $g': J' \to \mathcal{K}$ are two objects of $\mathcal{DK}$, then their product is the composite $J \times J' \stackrel{g \times g'}{\to} \mathcal{K} \times \mathcal{K} \stackrel{\text{prod}}{\to} \mathcal{K}$. I'll denote this as $g \cdot g': J \times J' \to \mathcal{K}$. If $p: L \to \mathcal{K}$ is another object, I claim the exponential $(p: L \to \mathcal{K})^{(g': J' \to \mathcal{K})}$ is the functor $p^{g'}: L^{J'} \to \mathcal{K}$ defined by a formula given by an end of exponentials in $\mathcal{K}$, 
$$p^{g'}(F) := \int_{j': J'} p(F(j'))^{g'(j')}.$$ 
This is a straightforward calculation: morphisms from $(g: J \to \mathcal{K}) \times (g': J' \to \mathcal{K})$ to $p: L \to \mathcal{K}$, say $(l: J \times J' \to L, \beta: g \cdot g' \Rightarrow pl)$, are clearly in natural bijection with pairs $(\hat{l}: J \to L^{J'}, \hat{\beta}: g \Rightarrow p^{g'} \circ \hat{l})$ where $\hat{l}(j) := l(j, -)$ and $\hat{\beta}$ is the natural transformation whose component at $j \in Ob(J)$ is naturally associated with the family $\beta_{j, j'}$ (indexed over $j'$) according to the evident natural bijection between morphisms indicated below: 
$$\frac{g(j) \times g'(j') \stackrel{\beta_{j, j'}}{\to} pl(j, j')}{g(j) \underset{\hat{\beta}_j}{\to} \int_{j'} pl(j, j')^{g'(j')}}$$ 
(holding $j$ fixed and currying the family $\beta_{j, j'}$ which is natural in $j'$ yields a family dinatural in $j'$, so that we get an induced map to the end which is a universal wedge for that dinatural family). 
(Perhaps this somewhat pedestrian calculation is a special case of some more abstract consideration, possibly involving a form of Artin gluing. For example, if we follow Karthik's comment and specialize to where the categories $I, J$ are discrete and $\mathcal{K}$ is say $\text{Set}$ or even a topos $E$, then $Fam(E)$ is the Artin gluing along $\Delta: \text{Set} \to E$. And indeed, if I recall correctly, Carboni and Johnstone do discuss Artin gluings in the doctrine of cartesian closed categories, so maybe something like this can be made to work. However, I am doubtful that one could dispense with completeness of $\mathcal{K}$, as the end calculation seems to mandate this.)