4 ms·
I would bring in efficient declarative programming. One could then tell the computer "I want the number which squared equals 2". The computer asks "To how many
by zelah 10y ago
I would bring in efficient declarative programming. One could then tell the computer "I want the number which squared equals 2". The computer asks "To how many decimal places?". You specify any number you like. It would be truly amazing to be able to say to the computer what you want calculated without having to say how you want it calculated!
- BjoernKW 10y agoSQL in some cases comes close enough, for example: SELECT sqrt(2) INTO square_root SELECT round(sqrt::NUMERIC, 2) FROM square_root An SQL console is a REPL environment that allows for interaction with previous results. So, apart from the natural language interface I think that's pretty much what you're describing (and if required that natural language interface could be added using something like Siri or wit.ai)
- zelah 10y agoNow suppose that the problem is not so straight forward as in finding the square root. Declarative programming in the general case would allow one to specify to a robot that it should walk to a certain location and arrive at a certain time. It knows (or can figure out) how to avoid crashing into things and also about not breaking laws and such. It can decide what time to leave the starting point but you don't have to tell it all the steps that will be involved. It is really about constraint satisfaction. Your program might look like this: "meetAt(workPlace , 5:00AM)". It is a well defined problem that clearly has right and wrong outcomes but the constraints are given, not a specific algorithm for the solution. Prolog is one example of a language that automatically solves declarative constraints but the syntax is bad.
- BjoernKW 10y ago> Prolog is one example of a language that automatically solves declarative constraints but the syntax is bad. That's why I mentioned SQL. Both SQL and Prolog are declarative languages but SQL has a much more approachable syntax. In SQL constraints can be expressed using WHERE and ON clauses. For your more complex robot example this would require some work but it's certainly possible.
- zelah 10y agoI will look closer at the SQL language then but what about efficiency?
- BjoernKW 10y agoIn general SQL is fast enough. In many cases it's faster than scripting languages or even faster than compiled languages (particularly when it comes to dealing with list or set data structures). RDBMS like PostgreSQL for example tend to be highly optimised and efficient pieces of software.
- dragonwriter 10y ago> Prolog is one example of a language that automatically solves declarative constraints but the syntax is bad. The syntax is fine, but conventional logic programming is insufficient for what you describe; you need something more likely constraint logic programming as inplemented in, among other languages, Oz.
- zelah 10y agoI will look at Oz.
- Piskvorrr 10y agoI want the string that hashed equals "deadbeef". And now we wait for +Infinity milliseconds for an answer to a deceptively simple question.
- zelah 10y agoYour example would defeat even genetic algorithms! But maybe a quantum computer could do it. If not, then I think the computer must have some artificial intelligence at the level of a human. It could respond: "I will try to find you an answer but the question is a hard one and I may have to quit early. How many minutes should I spend on this task?".
- cdvonstinkpot 10y agoLike this? https://news.ycombinator.com/item?id=13254006 https://news.ycombinator.com/item?id=13254006
- zelah 10y agoLike this: in the Scheme programming language you would write (define (add a b) (+ a b)) in my language you would write .(add).. a b number .(+).. a b to define subtraction declaratively in terms of "add" you would write the following .(sub).. a b number .(add).. () b a this says "to subtract b from a find the quantity that added to b equals a" genetic algorithms are used as a mechanism for finding the quantity in question