First make the ice cream. Put the pistachios and sugar in a food processor, and blend until finely chopped but with a little texture. Add the eggs and milk, and briefly blend again until combined. Pour the mixture into a saucepan and cook over a low-medium heat, stirring continuously, until thickened, taking care to not overcook the eggs and scramble the custard. Pour the thickened mixture into a bowl and stand it in a sink of ice-cold water to cool, stirring every now and then. Meanwhile, very softly whip the cream and extract (if using). Once cooled, stir the pistachio custard through the cream. Scrape into an ice cream machine and churn until icy, then scrape into a 20 x 30cm container, smooth the surface and put in the freezer for 2 hrs until frozen.
Now make the chocolate cookies. Heat oven to 190C/170C fan/gas 5. Line 2 large baking trays with baking parchment. Put the butter, sugars and vanilla in a bowl, and beat until smooth and creamy. Add the egg and beat again, then stir through the flour, cocoa, bicarbonateand chocolate. Scoop 16 golf-ball-sized mounds onto the baking trays, leaving plenty of space between each one, as they will spread when baked. (If your trays are small, you may only fit 6 on each, so you will have to do this in batches.) Bake for 15-17 mins, swapping the trays over halfway through baking – the cookies should still be quite soft when removed from the oven. Leave to cool on the trays. Can be baked up to 1 day ahead – simply cover the trays with cling film overnight.
Line 2 large baking trays with baking parchment and make space for them in your freezer. Put the white chocolate in
a bowl suspended over a pan of barely simmering water and leave to gently melt, stirring now and then – or melt in 20-sec blasts in the microwave. Remove the ice cream from the freezer and cut out 8 x 7cm circular pieces using a cookie cutter (a little smaller than the cookies). Ease out with a cutlery or palette knife and sandwich each between 2 cookies. Working quickly, drizzle the melted chocolate over the cookies, then sprinkle with chopped pistachios. Return to the freezer for 30 mins to firm up before serving. Will keep in the freezer for up to 2 weeks. Any leftover ice cream can be scooped into a processor while still frozen, blitzed, transferred back to a container and refrozen. Will keep for 1 month.