Tag Info

Hot answers tagged

9

In addition to assigning to In, the Mathematica main loop assigns the input to InString before it is parsed as an expression. You can then retrieve InString[1] and parse the result with ToExpression, wrapping it in Defer to prevent it from evaluating immediately: In[5]:= ToExpression[InString[1], StandardForm, Defer] Out[5]= Round[SessionTime[]] You can ...


7

$Epilog := PutAppend[DateList[], DownValues[In], "log.log"] will do what you want. It assumes the log file exists and will append to it. You could also place the PutAppend in the file end.m, where $Epilog reads from upon exit.


5

The input is stored as a downvalue in the definition of In. If you've only typed a few expressions, run Definition@In which prints a list of all the values associated with the symbol In, and copy from the line In[1] := Round[SessionTime[]]. But if you've typed hundreds of expressions, or expressions whose plain-text representations are long (like ...


1

This is a little raw but something along the lines of this should work... stream = OpenWrite["C:\\Temp\\KitchenSink.math"]; $Pre = (Write[stream, #]; #) &; $Post = (Write[stream, #]; #) &; When finished... Clear[$Pre, $Post]



Only top voted, non community-wiki answers of a minimum length are eligible