Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add readline support in polyml interpreter?

I found that polyml is the implementation of ML that can be easily installed on Ubuntu (named polyml in repository and can be executed with poly). I am following the A Gentle Introduction to ML by Andrew Cumming. After few minutes of experiment with polyml interpreter I found that it does not supports readline (pressing arrow up key produces a ^[[A).

This doesn't seems to be normal for an interpreter. This should only happen if I have no readline installed, but my Python interpreter doesn't behaves so.

like image 394
Santosh Kumar Avatar asked Jul 30 '13 06:07

Santosh Kumar


1 Answers

The simplest way to add readline support to a terminal program that does not natively support it, is to call the program using rlwrap. You can install the package of the same name through several package managers. Pressing in the examples below:

$ poly
Poly/ML 5.7.1 Release
- ^[[A

You can run it like this:

$ rlwrap poly
Poly/ML 5.7.1 Release
- stuff I typed from last session;

Or you can add an alias in your ~/.bashrc or similar:

alias poly='rlwrap poly'
like image 117
sshine Avatar answered Sep 28 '22 06:09

sshine