Place the coconut milk and sugar in a saucepan. Heat very gently over a low heat until the sugar dissolves - don't allow to boil. Remove from the heat. Leave to cool, then refrigerate for at least an hour until cold.
When the coconut mixture is completely chilled, add the pistachios to a food-processor and grind to a powder. Next, add the avocado flesh, then add the coconut mixture and a pinch of salt and blend until smooth. Taste and add a little more salt, if needed.
Transfer to an ice cream maker and churn for 30-40 minutes until very thick, then transfer to a freezer proof container (about 1 liter) and freeze for a least 4 hours, or until ready to use. If you don't have an ice cream maker, transfer the mixture to a freezer proof container and freeze for at least 8 hours, whisking every 30 minutes until solid.