質問

In Mathematica, the % function yields the value on the previous line. Is there a corresponding function in Clojure (Leiningen REPL)?

Mathematica Documentation:

%n or Out[n] is a global object that is assigned to be the value produced on the n^(th) output line.

% gives the last result generated.

%% gives the result before last. %%...% (k times) gives the k^(th) previous result.

役に立ちましたか?

解決

yes, partially. From the REPL you get the previous three results:

*1 for the most recent result
*2 for the next most recent
*3 for the third most, though that's all you get.
*e for the most recent exception that made it to the top level.

It seems not to have arbitrary recall like Mathmatica though. It is also worth noting that these are only available from the repl, not in your functions or namespaces.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top