Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

read eval print loop - How do I get the last evaluated expression in OCaml's toplevel?

How do I refer to the last evaluated expression in OCaml's toplevel repl?

I.e. JavaScript uses $_, python uses _, and haskell ghci uses it.

question from:https://stackoverflow.com/questions/65874487/how-do-i-get-the-last-evaluated-expression-in-ocamls-toplevel

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This is not implemented by the default ocaml REPL bundled with the compiler. With utop, there is an option to enable this behavior with the -implicit-bindings flag. With this settings, all anonymous bindings are named as _0,_1,_2,... .


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...