使用 ocaml utop 打印历史列表
Print history list with ocaml utop
有没有办法在 utop 中打印历史列表,比如从 bash 调用 history
?我也没有在 emacs 中找到任何与 utop-mode
相关的历史记录。我正在尝试使用历史在 REPL 中进行嬉皮扩展。
Utop 似乎可以响应 history-prev
和 history-next
(来自 utop.el
)等命令,但这就是我所发现的。
这个
μ> #require "lambda-term";;
μ> LTerm_history.contents UTop.history;;
将打印出你的 utop
历史作为 OCaml 字符串列表,第一个元素是你执行的最新命令(这并不奇怪
"LTerm_history.contents UTop.history;;"
).
注意:您可以将 #require "lambda-term";;
添加到 .ocamlinit
文件中以跳过上面清单中的第一个命令。
还有 ~/.utop-history
文件,如果您想使用一些系统实用程序来访问您的 utop
历史记录。
有没有办法在 utop 中打印历史列表,比如从 bash 调用 history
?我也没有在 emacs 中找到任何与 utop-mode
相关的历史记录。我正在尝试使用历史在 REPL 中进行嬉皮扩展。
Utop 似乎可以响应 history-prev
和 history-next
(来自 utop.el
)等命令,但这就是我所发现的。
这个
μ> #require "lambda-term";;
μ> LTerm_history.contents UTop.history;;
将打印出你的 utop
历史作为 OCaml 字符串列表,第一个元素是你执行的最新命令(这并不奇怪
"LTerm_history.contents UTop.history;;"
).
注意:您可以将 #require "lambda-term";;
添加到 .ocamlinit
文件中以跳过上面清单中的第一个命令。
还有 ~/.utop-history
文件,如果您想使用一些系统实用程序来访问您的 utop
历史记录。