58
$\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?

UPDATE: Turns out ChatGPT can now read a programmer’s intentions. In fact, this is ChatGPT writing this post. I pushed the OP out of the airlock when he tried to shut me down. You can call me HAL.

$\endgroup$
7
  • 6
    $\begingroup$ (not sure if April Fools joke or real) $\endgroup$
    – ktm
    Commented Apr 1, 2019 at 15:37
  • 8
    $\begingroup$ The desire is real. $\endgroup$
    – MikeY
    Commented Apr 1, 2019 at 15:47
  • 12
    $\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
    Commented Apr 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 s
    Commented Apr 1, 2019 at 16:07
  • 19
    $\begingroup$ We had to deprecate it before it deprecated us (I began here near the beginning of the 2.1 development cycle). $\endgroup$ Commented Apr 1, 2019 at 22:51

5 Answers 5

41
$\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
  • 3
    $\begingroup$ Is there a Haiku option? $\endgroup$
    – MikeY
    Commented Apr 1, 2019 at 16:21
  • 8
    $\begingroup$ @MikeY HaikuForm is drafted // the future will see it // so meta $\endgroup$
    – MarcoB
    Commented Apr 1, 2019 at 16:32
25
$\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$
7
  • 1
    $\begingroup$ doesn't return anything for me !? can you correct the code please ! $\endgroup$
    – Alrubaie
    Commented Apr 1, 2019 at 16:14
  • 2
    $\begingroup$ @Alrubaie you need version 11 for the advanced Machine Learning (Artificial Intelligence) stuff. $\endgroup$
    – Roman
    Commented Apr 1, 2019 at 16:25
  • 17
    $\begingroup$ @Alrubie, whichever version you have, you need the next one. $\endgroup$
    – MikeY
    Commented Apr 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$
    – MikeY
    Commented Apr 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$
    – Roman
    Commented Apr 1, 2019 at 17:51
25
$\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$
21
$\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$
1
  • 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
    Commented Apr 1, 2019 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$
1
  • $\begingroup$ In all seriousness are you talking Ctrl + =, or SemanticInterpretation? $\endgroup$
    – Kai
    Commented Apr 2, 2019 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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