Hi at my school in my engineering computations class we were talking about programming a replica of the human mind. The problem was brought up that the computer will only run until the it runs out of code to read. My question is this. Is there a computing language that has the ability to write self sustaining code during execution? That is generate code dynamically based on parameters given at the start of the program? Would this be hard to implement?

If your still confused imagine you are riding the slope of a function of nth parameters and you do not know what the explicit function is but you have incite of what the gradient is 1 unit forward and back of your position.

Since we only know two points of the gradient in total space, writing loops initializing the start and end points will not work. However if we only initialize the beginning point and tell the computer to calculate the gradient of the line at the forward and backward positions in space we can then estimate the gradient of the line at the next point and compare this gradient to the gradient of the previous point and "guess" what the next value of the gradient would be. For this to happen the computer would have to make a choice of the best method to compare the two slopes and instead of explicitly writing if-then checks and outcomes we only write one if statement which is "the method that has the higher presidency is most likely to be the best method to choose". Logically at the start of the program we have given the computer starter methods to solve this problem and therefore the computer executes all of them and decides which is the best choice for this step. It then logs this choice out of the lists as having a higher success rate over the other methods and takes that into account at the next step. If we could then find a way for the computer to know if a choice it made is wrong we could tell it to backtrack and try again.

What do you guys think?