In version 2.0 of Mathematica there was a command, ReadProgrammerIntentions[ ]
which allowed it rapidly compose code that could solve problems simple to complex, based on my requirements. Understand it was deprecated in later versions. Is there a similar functionality available in maybe a hidden package?
-
6$\begingroup$ (not sure if April Fools joke or real) $\endgroup$– ktmApr 1, 2019 at 15:37
-
8$\begingroup$ The desire is real. $\endgroup$– MikeYApr 1, 2019 at 15:47
-
11$\begingroup$ To get this to work, you need to write all your code in Eton-accented English. The system will recognise you and put you into SW-mode, allowing you to simply write code by employing dozens of programmers to do so for you. (/s) $\endgroup$– Carl LangeApr 1, 2019 at 16:07
-
10$\begingroup$ The feature of early Mathematica that I really miss is support for the Klingon Language character set. $\endgroup$– bill sApr 1, 2019 at 16:07
-
17$\begingroup$ We had to deprecate it before it deprecated us (I began here near the beginning of the 2.1 development cycle). $\endgroup$– Daniel LichtblauApr 1, 2019 at 22:51
5 Answers
Indeed, this functionality still exists, but it has been moved into its own package.
Load the package:
Needs["aBetterProgrammer`"]
You will have access to such functions as
GimmeDaCodez
(answers any nebulous MMA.SE question by guessing the unspoken needs of the asker)WizardForm
(an output wrapper; produces perfectly terse code; all function calls are infix)JMstyle
(deals with special functions; sometimes works even without a computer)
... and many others.
-
2
-
7$\begingroup$ @MikeY
HaikuForm
is drafted // the future will see it // so meta $\endgroup$– MarcoBApr 1, 2019 at 16:32
Since version 11 most commands finally support the Interpretation
option: Interpretation -> "Literal"
being the classical (default) way of operation, and Interpretation -> "Guess"
using advanced machine learning to get much better results than ReadProgrammerIntentions
ever achieved. Makes programming a lot easier. You can emulate the old behavior with a simple Return["the result", Interpretation -> "Guess"]
.
-
1$\begingroup$ doesn't return anything for me !? can you correct the code please ! $\endgroup$– AlrubaieApr 1, 2019 at 16:14
-
1$\begingroup$ @Alrubaie you need version 11 for the advanced Machine Learning (Artificial Intelligence) stuff. $\endgroup$– RomanApr 1, 2019 at 16:25
-
16$\begingroup$ @Alrubie, whichever version you have, you need the next one. $\endgroup$– MikeYApr 1, 2019 at 16:31
-
4$\begingroup$ Roman, whenever I try your code with the
Guess
option set, my 10-year old gets an email. $\endgroup$– MikeYApr 1, 2019 at 17:40 -
4$\begingroup$ Yes @MikeY, Mathematica is probably aware that s?he knows best and needs to be consulted. Same at my place. $\endgroup$– RomanApr 1, 2019 at 17:51
I tend to use a pattern matching approach:
myCode/.{x_?BugQ:>BugStrip[x],x_?TypoQ:>Detypo[x],x_?WrongSignQ:>-x,x_?OffBy2PiQ:>x*2\[Pi]}
With the usual caveat that pattern matching can be slower than other methods, but conceptually easier to understand. Hopefully someone will aggregate the answers to compare performance. Good luck!
This function was deprecated in V4.2, being succeeded by CellularAutomaton
.
Since your answer is hidden somewhere in rules like 110, why reinvent the wheel with ReadProgrammerIntentions
?
-
7$\begingroup$ I tried using The Game of Life, but my answer was stuck with a Glider last seen wandering off towards Hoboken. $\endgroup$– MikeYApr 1, 2019 at 22:04
In all seriousness you can achieve something similar by pressing the equal key once. It will turn input to "Free input" and display a big orange equal sign by the side. In this field you can type your calculation how you would said in English and it will generate the code to do it.
Also if you press the key twice the it will show a star shape sign and your input will be send to Wolfram alpha to so you can get more complex answers involving data and stuff.
-
$\begingroup$ In all seriousness are you talking
Ctrl + =
, orSemanticInterpretation
? $\endgroup$– KaiApr 2, 2019 at 6:45