3

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.

ghilesZ
  • 1,502
  • 1
  • 18
  • 30
Alex Coleman
  • 607
  • 1
  • 4
  • 11

1 Answers1

5

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

octachron
  • 17,178
  • 2
  • 16
  • 23