6

I am learning standard ML using its interpreter. Sometimes I make typo and just want to repeat the previous command like in Linux shell. However, up arrow will end up with printing special characters on the screen. Sometimes I want to go back left to correct something, left arrow also results in printing special characters.

Does anybody know what is the correct way to do them?

2
  • Looks like a duplicate of - stackoverflow.com/questions/1911861/… Commented Apr 7, 2012 at 18:52
  • Excellent! How come I didn't find that at google... Thanks a lot for pointing out, that is awesome! Commented Apr 7, 2012 at 19:14

3 Answers 3

9

I use Moscow ML, but I figure the answer will apply to whichever version you use:

You can achieve what you want by using rlwrap.

I have the following alias set in my .zshrc, which handles it automatically:

alias mosml="rlwrap mosml"

(Substitute mosml for the name of your SML interpreter.)

Sign up to request clarification or add additional context in comments.

Comments

6

Consider using the program ledit. It allows you to use the arrow keys to visit previous commands.

Example:

ledit mosml

1 Comment

this is beautiful and works for smlnj and others too - thanks!
-1

If you are going to be doing any serious SML hacking I strongly suggest you use a development environment that allows you to interact with the SML top level environment.

I use Emacs with the SML mode. The beauty here is that in the top window you can code functions and save them to a file. You can then send them to the lower window that holds the Inferior-SML process for compilation. Also the Inferior-SML process has by default a command history.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.