An interactive programming language?

Is there a programming language that can be programmed fully interactively, without the need to write files that are interpreted or compiled. Think, maybe, something like IRB for Ruby, but a system that is designed so that you can write the entire program from the command line.

+7
programming-languages
source share
13 answers

Smalltalk can be programmed fully interactively, but I would not invoke the smalltalk command line prompt. Most lisp environments are also similar. Also postscript (as in printers) if memory is serving.

You say you want to write a program without seeing more code than the one that fits in the scroll buffer of your command window?

+6
source share

I assume you are looking for something similar to how BASIC works (boot up to the BASIC prompt and start coding).

IPython allows you to do this quite intuitively. Unix shells such as Bash use the same concept, but you cannot reuse and save your work almost as intuitively as in IPython. Python is also a much better general purpose language.

Edit: I was going to introduce some examples and provide some links, but the IPython interactive tutorial seems to do this much better than I could. Good starting points for what you are looking for are source code processing tips and lightweight version control . Please note that this tutorial does not indicate how to do everything you are looking for exactly, but it does provide a transition point to understand the interactive functions of the IPython shell.

Also consider the IPython "magic" reference , as it provides many utilities that do things specific to what you want to do, and allows you to easily define your own. This is very "meta", but an example that shows how to create an IPython magic function is probably the shortest example of a "full application" built into IPython.

+6
source share

There is always lisp, the original Smalltalk alternative with this feature.

+4
source share

The only way to avoid writing any files is to completely switch to a working interactive environment. When you program this way (i.e. interactively, for example, in IRB or F # interactive), how do you distribute your programs? When you exit the IRB or F # interactive console, you lose all the code that you wrote online.

Smalltalk (see a modern implementation like Squeak ) solves this, and I don't know about any other environment where you could completely avoid files. The solution is that you distribute the image of the working environment (including your interactively created program). In Smalltalk, they are called images .

+3
source share

As already mentioned, Python has some nice interactive shells, I would recommend bpython for starters instead of ipython, the advantage of bpython here is support for autocomplete and help dialogs to help you find out what arguments a function takes or what it takes (if it has docstrings )

+2
source share

It really is a question of implementations, not languages, but

  • Smalltalk (try Squeak ) saves all your work in an "interactive workspace", but it's graphic and not command line oriented.

  • The APL, which was first installed on the IBM 360 and 370 systems, was fully interactive using the command line on a modified IBM Selectric typewriter! Your APL functions are stored in a “workspace” that is completely different from a regular file.

  • Many, many language implementations come with clean interactive command-line interpreters, such as the New Jersey ML Standard , but because they don’t offer any permanent namespace (i.e. when you exit the program, all your work is lost), I I don’t think they really should count.

Interestingly, the premier leaders for Smalltalk and APL (Kay and Iverson respectively) won Turing awards. (Iverson received his Turing Award after being denied storage at Harvard.)

+2
source share

TCL can be programmed fully interactively, and you can clearly define new tcl processes (or override existing ones) without saving the file.

Of course, if you are developing a complete application at some point, you want to save the file, otherwise you will lose everything. Using TCL's introspective abilities, it is relatively easy to dump some or all of the current state of the interpreter into a tcl file (I wrote a prok to make it easier, but basically I would only develop the file in the first place and have a function in the application for the resources themselves, if its source changes).

+2
source share

Any unix shell matches your question. This comes from bash, sh, csh, ksh to tclsh for TCL or wants to write a TK GUI.

+2
source share

Not sure about this, but this system is impressively interactive: http://rigsomelight.com/2014/05/01/interactive-programming-flappy-bird-clojurescript.html

+2
source share

Most Lisp options make it easy to save an interactive work product as program files, because code is just data.

Charles Simoni’s intentional programming concept can also be a part, but that’s not the way you can go and buy it yet. The Intentional Workbench may be worth a look.

+1
source share

Many of the Forths can be used like this.

+1
source share

Someone already mentioned Forth, but I would like to tell a little about the history of Fort. Traditionally, Forth is a programming language that is its own operating system. Traditional Forth saves the program directly to disk sectors without using a “real” file system. He could afford to do this because he did not work directly with the processor without an operating system, so he did not need to play well.

Indeed, some implementations have Forth not only as an operating system, but also a CPU (in fact, many modern stack-based processors are designed as Forth machines).

In the original Forth implementation, the code is always compiled every time a string is entered and saved to disk. This is possible because Forth is very easy to compile. You just start the interpreter, play with the Forth defining functions as needed, and then just walk away from the interpreter. The next time you start the interpreter, all your previous functions still exist. Of course, not all modern Forth implementations work this way.

+1
source share

Clojure

This is a functional Lisp on the JVM. You can connect to a REPL server called nREPL, and from there you can start writing code in a text file and download it interactively as you go.

Clojure gives you something similar to interactive unit testing.

I think Clojure is more interactive than other Lisps because it strongly emphasizes the functional paradigm. It is easier to perform hot swap functions when they are clean.

The best way to check this out: http://web.clojurerepl.com/

ELM

ELM is probably the most interactive you can get that I know of. This is a very clean functional language with syntax similar to Haskell. What is especially important is that it is designed around a reactive model that allows hot swapping (changing the startup code (function or value)) of the code. The reactive bit makes it so that whenever you change one thing, everything is reevaluated.

ELM is now compiled into HTML-CSS-JavaScript. Therefore, you cannot use it for everything.

ELM gives you something like interactive integration testing.

Best way to try: http://elm-lang.org/try

+1
source share

All Articles