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?
Coding Evolution
I think your best bet would be to go with an interpreted language, such as ruby and python. With those languages, you can have it write new code to a file as it goes, and then load that same file as code on the fly. Since it is interpreted, there's no need to compile it before you run it. Alternatively, most interpreted languages have a function that allows you to evaluate a string as code. For instance, in ruby you can do:
And it will print out "Hello World!"
EDIT: By the way, that thing you were talking about, riding the curve of an unknown function to try to guess where it's going next... they call that calculus
Code: Select all
eval("p \"Hello World!\"")
EDIT: By the way, that thing you were talking about, riding the curve of an unknown function to try to guess where it's going next... they call that calculus
-
- Posts: 288
- Joined: Wed Oct 29, 2008 12:07 pm
Yes you are right. Except the problem in my example is you only know two slope positions not every point. The idea is not to solve the problem but have the computer establish an optimal path so next time it may be evaluated faster. Or in another way be more "human like".DeM0nFiRe wrote:
EDIT: By the way, that thing you were talking about, riding the curve of an unknown function to try to guess where it's going next... they call that calculus
Writing code on the fly is not the difficult part.Alpha Omega wrote: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?
It's writing useful code on the fly that is difficult.
To mimic a human won't be easy even on the simplest scale.
You are talking about AI.
A good AI language is Prolog. You tell it what you want to do, not how to do it as in C++.
It performs every possible combination and returns every possible solution.
I think that may be what you are looking for.
I programmed an A* search algorithm with it at Uni.
But I warn you, it's not for the light-hearted.
You need to be logical and understand recursion. It's not easy to trace the code.
I can hear birds chirping
I live in the Eye of Insanity.
I live in the Eye of Insanity.
-
- Posts: 126
- Joined: Sun Apr 02, 2006 1:21 am
- Location: Canada
I think the concept is a fairly simple one. The implementation, well, I won't go there, but the concept itself doesn't seem to overwhelming.
You would need a "Live" function. A "Learn" function. A "Contemplate" function. And finally a "Communicate" function.
Communicate would take a string as an argument, contemplate the string, and output the results of the contemplation.
Contemplate would take a string as an argument, compare against it's knowledge base, check for patterns, << insert magical formula for learning here >>, Learn the results of its contemplation if it does not already know it, and return the results.
Learn would take a string and compare against it's knowledge base. If it doesn't already "know" the contents of it's string, then it adds it to the knowledge base.
Live would wait for input of somekind that it could contemplate. If there is ever a time when there is no input, or it is not contemplating input, then it would contemplate something random in the hopes that it might conclude something new based on knowledge it may have gained recently.
Of course, I'm not so naive as to think it's just that simple, but as a concept it doesn't seem to monumental. Of course, it would have to have a very effective String parser that could break down any possible string into useful information. It would have to be able to query a huge database very quickly, looking for all kinds of patterns, perhaps even looking for new kinds of patterns.
Anyways, if you think I'm crazy or something, what I essentially am trying to get at is that I don't think you need to write a program that can extend it's code. I think you would need to write a program that is capable of dealing with very large amounts of data, some of which perhaps being new patterns that it should look for in it's data.
So for example, you might give it the following information:
If I jump in the water then I will get wet.
I jumped in the water.
The program should contemplate this and conclude that you are wet, but not only that, it should be creating rules for itself so that the next time it comes across this situation it's contemplation should be much faster.
However, the rule that it creates for itself should itself be information stored just as the info you gave it is. In this way, it could, at some time, if the right situation came about, contemplate the rule itself against other info that it has, so that it might extend or revise it's rule.
Yea... that's all I gotta say. I don't think it should write it;s own code, I think it should be operating on information.
You would need a "Live" function. A "Learn" function. A "Contemplate" function. And finally a "Communicate" function.
Communicate would take a string as an argument, contemplate the string, and output the results of the contemplation.
Contemplate would take a string as an argument, compare against it's knowledge base, check for patterns, << insert magical formula for learning here >>, Learn the results of its contemplation if it does not already know it, and return the results.
Learn would take a string and compare against it's knowledge base. If it doesn't already "know" the contents of it's string, then it adds it to the knowledge base.
Live would wait for input of somekind that it could contemplate. If there is ever a time when there is no input, or it is not contemplating input, then it would contemplate something random in the hopes that it might conclude something new based on knowledge it may have gained recently.
Of course, I'm not so naive as to think it's just that simple, but as a concept it doesn't seem to monumental. Of course, it would have to have a very effective String parser that could break down any possible string into useful information. It would have to be able to query a huge database very quickly, looking for all kinds of patterns, perhaps even looking for new kinds of patterns.
Anyways, if you think I'm crazy or something, what I essentially am trying to get at is that I don't think you need to write a program that can extend it's code. I think you would need to write a program that is capable of dealing with very large amounts of data, some of which perhaps being new patterns that it should look for in it's data.
So for example, you might give it the following information:
If I jump in the water then I will get wet.
I jumped in the water.
The program should contemplate this and conclude that you are wet, but not only that, it should be creating rules for itself so that the next time it comes across this situation it's contemplation should be much faster.
However, the rule that it creates for itself should itself be information stored just as the info you gave it is. In this way, it could, at some time, if the right situation came about, contemplate the rule itself against other info that it has, so that it might extend or revise it's rule.
Yea... that's all I gotta say. I don't think it should write it;s own code, I think it should be operating on information.