that would need intelligence of knowing what the purpose should be / what the deterministic of it self should be.
So in theory we could do some of it. But it's hard to do so I guess it could duplicate it self in an evolved form and so find out if it's programming was improved / fixed. basically what our bodies do.
Cool and hard topic :D ....