Heat oven to 190C/fan 170C/gas 5. Put the chopped apples, lemonzest, rosemary, if using, and sugar in a saucepan. Add the lemon juice and cook for 3-4 mins. Tip in the pears and cook 2-3 mins more, until the fruits are just beginning to soften. Spoon the fruits and juices into a 1.7 litre pudding dish and flatten slightly.
For the crumble, finely chop half the walnuts in a food processor until reduced to the consistency of ground almonds. Add the flour, butter and sugar and continue to blitz to a coarse or fine crumble mix, whichever you prefer.
Roughly break the remaining walnuts with your fingers and stir into the crumble. Scatter the crumble mix on top of the fruits and bake for 20-25 mins until golden brown. Serve warm with cream or custard.