51
$\begingroup$

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?

$\endgroup$
  • 6
    $\begingroup$ (not sure if April Fools joke or real) $\endgroup$ – user6014 Apr 1 at 15:37
  • 6
    $\begingroup$ The desire is real. $\endgroup$ – MikeY Apr 1 at 15:47
  • 10
    $\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 Lange Apr 1 at 16:07
  • 10
    $\begingroup$ The feature of early Mathematica that I really miss is support for the Klingon Language character set. $\endgroup$ – bill s Apr 1 at 16:07
  • 15
    $\begingroup$ We had to deprecate it before it deprecated us (I began here near the beginning of the 2.1 development cycle). $\endgroup$ – Daniel Lichtblau Apr 1 at 22:51
38
$\begingroup$

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.

$\endgroup$
  • 2
    $\begingroup$ Is there a Haiku option? $\endgroup$ – MikeY Apr 1 at 16:21
  • 7
    $\begingroup$ @MikeY HaikuForm is drafted // the future will see it // so meta $\endgroup$ – MarcoB Apr 1 at 16:32
23
$\begingroup$

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"].

$\endgroup$
  • 1
    $\begingroup$ doesn't return anything for me !? can you correct the code please ! $\endgroup$ – Alrubaie Apr 1 at 16:14
  • 1
    $\begingroup$ @Alrubaie you need version 11 for the advanced Machine Learning (Artificial Intelligence) stuff. $\endgroup$ – Roman Apr 1 at 16:25
  • 16
    $\begingroup$ @Alrubie, whichever version you have, you need the next one. $\endgroup$ – MikeY Apr 1 at 16:31
  • 4
    $\begingroup$ Roman, whenever I try your code with the Guess option set, my 10-year old gets an email. $\endgroup$ – MikeY Apr 1 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$ – Roman Apr 1 at 17:51
20
$\begingroup$

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!

$\endgroup$
18
$\begingroup$

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?

$\endgroup$
  • 7
    $\begingroup$ I tried using The Game of Life, but my answer was stuck with a Glider last seen wandering off towards Hoboken. $\endgroup$ – MikeY Apr 1 at 22:04
8
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ In all seriousness are you talking Ctrl + =, or SemanticInterpretation? $\endgroup$ – Kai Apr 2 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.