<blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">Hi there,<br><br>
first of all Paul and Dave, thanks for replying!!  The question can perhaps<br>
be best explained<br>
with an example:<br><br>
repl=> (defun doit-3 (x)<br>
(* 3 x))<br>
repl=> '(some more cool stuff)<br>
repl=>'(and more and more)<br><br>
i keep testing and playing around with functions<br>
more and more<br><br>
I can certainly run my doit-3 function<br><br>
repl=>(doit-3 4)<br>
12<br>
repl=><br><br>
and now, I say to myself, - how the heck did I write that doit-3, I forgot,<br>
because,<br>
I wrote it 20 minutes ago, it obviously exists inside REPL because I can<br>
execute it...<br>
So, how do I view [dump??] the contents of doit-3 to the screen, or to a<br>
file on the<br>
disk, so I can invoke an editor and modify doit-3 and then reload it??<br><br>
I am just interested in learning how to be more productive in a standard<br>
software<br>
development cycle.<br><br>
Thanks, Alex.</blockquote><div><br>If you typed the function in recently enough, you can hit Ctrl+up (or similar depending on what kind of prompt you're using) to see previous definitions you entered, but there's sometimes a limit to how much history you can access that way.<br>
<br>If the only place you've typed the function is into the REPL, and you can't get far enough up using REPL history, then there isn't really a way of backing the definition out. With your example above:<br><br>
=> (defun doit-3 (x) (* 3 x))<br>DOIT-3<br><br>=> (doit-3 4)<br>12<br><br>[some time later your typing history runs out and you forgot how doit-3 was defined]<br><br>=> #'doit-3<br>#<FUNCTION DOIT-3><br>
<br>If you're used to JavaScript, this seems asinine; why doesn't it just print out the function text? The reason is that when you define a function, it's compiled into some form of byte-code and the REPL throws away the initial representation (in JavaScript that doesn't happen so you can easily get the definition given a function name).<br>
<br>The sure way to have access to functions you've written earlier is to record them in a file, as opposed to just the REPL. You've gotten some LispWorks pointers already (which I assume are correct, I don't use it myself). In Emacs/slime, the way you'd do this is <br>
1. split your window [default binding C-x 2 or C-x 3 for a vertical split]<br>2. open a lisp file in one, and slime in the other [M-x slime]<br>3. type your definitions out in the lisp file, and use Emacs keystrokes to send individual definitions into the prompt [default binding C-M-x]<br>
<br>C-M-x will send the definition closest your pointer to the SLIME prompt as though you typed it there, but you'll still have access to the initial definition. If you need to redefine it, just make the changes and hit C-M-x again with your pointer somewhere in the definition.<br>
<br>-Leo<br></div>