Add readline features in OCaml toplevel

It is painful for a Linux user to use the OCaml toplevel without the readline features.

Is there a method to enable/add these kinds of features in readline to the OCaml toplevel?

I find 2 options that work very well for me:

utop provides a beautiful interface and supports completion, colors, parenthesis matching, etc. It can be installed by OPAM: opam install utop.

Another simple way I found is to use the rlwrap for line editing support: https://www.systutorials.com/docs/linux/man/1-rlwrap/

To start the OCaml toplevel with rlwrap, run:

$ rlwrap ocaml

Or wrap it in a shell script:

#!/bin/sh
exec rlwrap /usr/bin/ocaml "$@"

Similar Posts

  • Micosoft招聘部分算法题

    Micosoft招聘部分算法题 1.链表和数组的区别在哪里? 2.编写实现链表排序的一种算法。说明为什么你会选择用这样的方法? 3.编写实现数组排序的一种算法。说明为什么你会选择用这样的方法? 4.请编写能直接实现strstr()函数功能的代码。 5.编写反转字符串的程序,要求优化速度、优化空间。 6.在链表里如何发现循环链接? 7.给出洗牌的一个算法,并将洗好的牌存储在一个整形数组里。 8.写一个函数,检查字符是否是整数,如果是,返回其整数值。(或者:怎样只用4行代码编写出一个从字符串到长整形的函数?) 9.给出一个函数来输出一个字符串的所有排列。 10.请编写实现malloc()内存分配函数功能一样的代码。 11.给出一个函数来复制两个字符串A和B。字符串A的后几个字节和字符串B的前几个字节重叠。 12.怎样编写一个程序,把一个有序整数数组放到二叉树中? 13.怎样从顶部开始逐层打印二叉树结点数据?请编程。 14.怎样把一个链表掉个顺序(也就是反序,注意链表的边界条件并考虑空链表)? 来源:·日月光华 bbs.fudan.edu.cn Read more: COM Port Programming in Win32 C++ Reference and Styles Git through SSH Tunnel as Proxy Profiling Vim to Find Out Which Plugin Makes Vim Slow Spring Shell Technology For Java development How to remove newline characters…

  • Maximum number of mmap()’ed ranges and how to set it on Linux?

    What’s the maximum number of mmap()‘ed ranges that a process can makes and how to set the limits on Linux? I have a program that mmap()s and mprotect()s lots ranges. After allocating many ranges, mprotect() starts to fail with ENOMEM error number. From the man page, ENOMEM means 2 possible problems: ENOMEM Internal kernel structures…

  • What is Double-Blind review for a paper?

    I want to submit my paper to NAS 2015 but I am confused about its double-blind review 盲审又包括单盲审(Single-Blind Peer Review, SBPR)和双盲审(Double-Blind Peer Review, DBPR)。双盲审是审者与作者之间互相都不知道彼此身份的匿名评审。在双盲审的过程中,中间组织者的规范和保密工作很重要。单盲审一般是审者知道作者的身份,而作者不知道审者是谁。 计算机有不少会议实行双盲评审。 Reference: http://emuch.net/html/201104/3022021.html Read more: When should the authors anonymize themselves in a paper submitted to a conference for review? How to write paper reviews? How to convert A4 paper format…

Leave a Reply

Your email address will not be published. Required fields are marked *