Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modify Lisp function without rewriting it?

I wrote a Lisp function earlier that had an error. The first challenge was to figure out how to view the function again. That challenge is solved. Now that I see WHAT I have done wrong, I want to modify the contents of the defined function without rewriting the whole thing?

Seems like as intelligent as Lisp is, there HAS to be a way to do this, I just don't know what it is because I am fairly new to the language. Can this be done?

like image 867
trh178 Avatar asked Jul 27 '10 13:07

trh178


2 Answers

Judging from the question, I think that you have a strange setup. It seems to indicate that you are writing your functions directly at the REPL. Don't do that.

The usual setup is to have an IDE (for example, Emacs with Slime) where you edit a source file, and then "send" top-level forms (like function definitions) to the REPL.

like image 67
Svante Avatar answered Oct 27 '22 09:10

Svante


Every useful REPL has a history functionality. It allows you to move in the history of your input backwards and forwards.

When I write code in the REPL simple keystrokes like m-p gets back earlier code. Some IDEs might even be able to locate source code in a Lisp listener with m-. .

In most REPLS you can also search incrementally backwards.

If you want a log of your input use the function DRIBBLE..

There are some more options, like retrieving the code from the function - when a Lisp IDE supports that.

like image 31
Rainer Joswig Avatar answered Oct 27 '22 09:10

Rainer Joswig