Idea – Extracting Instructions From Data?

I had an idea yesterday. A simple example of extracting instructions comes from music. I think you already can extract the notes as the instructions. I wonder therefor if other data can be separated into instructions and its applied functions. I guess if you could separate the instruction and the function then a computer could learn the function and operate on different instructions. Also if the instruction can be extracted. One could let the same instruction operate with different functions. With this you could possibly find a better function.