Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get code from REPL

If I'm entering code into the REPL using clisp, as in the program you get when you do sudo apt-get install clisp, is there a way to take all the code you've entered so far and save it in a file? I'm a Lisp beginner so I don't know if that's a ridiculous request or not.

like image 618
Jason Swett Avatar asked Nov 19 '10 21:11

Jason Swett


People also ask

Is REPL it good for coding?

I highly recommend that students in IT classes or students with an interest in programming try out the Repl.it IDE so they can better understand their writing and can practice important skills.

What is a repl code?

A read–eval–print loop (REPL), also termed an interactive toplevel or language shell, is a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user; a program written in a REPL environment is executed piecewise.

How do I save a Replit code as a PDF?

If your repl is a HTMl website, then go to the website (enter the address above your repl's output), hit Ctrl+P and set the print destination to 'Save to Pdf'. You can then select where to save it on your computer.

How do I use Replit code generator?

If you're a Hacker Plan subscriber, head to the workspace and pick the “Generate code” feature from the context menu. Tell it what you want, and it will automatically detects the language of the file you're in and give you back its best attempt at what you requested.


2 Answers

You can start output recording with the function DRIBBLE.

Other than that I would run CLISP from a terminal program which can save input / output.

As the minimum I would usually use Emacs, run a shell via M-x shell and start the Lisp there. That way the I/O goes into an Emacs shell buffer.

There is also SLIME, which sets up quite a bit more functionality inside Emacs to communicate with a 'slave' Common Lisp. A 'listener' (aka REPL) is part of that.

like image 172
Rainer Joswig Avatar answered Sep 18 '22 12:09

Rainer Joswig


There is probably a better way, but... If you are using a decent terminal program, you should be able to select the text in the terminal and save it to file. This would include your typed input as well as output, so you would have to manually remove the output.

like image 34
Justin Ethier Avatar answered Sep 21 '22 12:09

Justin Ethier