Not in a function, but with a batch of different functions:
Somthing like this...
# remove my changes
apm.lib.utils.recycling.scrap.remove('electronic-circuit')
apm.lib.utils.recycling.scrap.remove('advanced-circuit')
apm.lib.utils.recycling.scrap.remove('processing-unit')
# green circuit
apm.lib.utils.recipe.result.mod('electronic-circuit', 'electronic-circuit', 0)
apm.lib.utils.recipe.result.add_with_probability('electronic-circuit', 'electronic-circuit', 0, 1, 0.7)
apm.lib.utils.recycling.scrap.add('electronic-circuit', 'iron', 0.3)
apm.lib.utils.recycling.scrap.add('electronic-circuit', 'copper', 0.3)
# red circuit
apm.lib.utils.recipe.result.mod('advanced-circuit', 'advanced-circuit', 0)
apm.lib.utils.recipe.result.add_with_probability('advanced-circuit', 'advanced-circuit', 0, 1, 0.8)
apm.lib.utils.recycling.scrap.add('advanced-circuit', 'iron', 0.2)
apm.lib.utils.recycling.scrap.add('advanced-circuit', 'copper', 0.2)
# blue circuit
apm.lib.utils.recipe.result.mod('processing-unit', 'processing-unit', 0)
apm.lib.utils.recipe.result.add_with_probability('processing-unit', 'processing-unit', 0, 1, 0.9)
apm.lib.utils.recycling.scrap.add('processing-unit', 'iron', 0.1)
apm.lib.utils.recycling.scrap.add('processing-unit', 'copper', 0.1)