Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k 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 OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...