Alex Coleman
Alex Coleman

Reputation: 647

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.

Upvotes: 3

Views: 253

Answers (1)

octachron
octachron

Reputation: 18892

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,... .

Upvotes: 6

Related Questions