# clisp beginner questions

This topic is 4888 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

i know clisp is interpreted like perl, bash or python, does it use bytecode like python or java and can it be compiled into a binary? i am able to run the clisp interpreter in the interactive console and type code in, use the load function to load in my hello-world
(defun hello-world()
(format t "Hello, World!!!"))

(hello-world)


(the last line is me trying to call hello-world in the global namespace like in perl or python) can i compile this to binary? can i compile this to bytecode? how can i just get the interpreter to interpret this silently and exit
$clisp -c hello.lisp$ ./a.out
Hello, World!!!
$clisp -b hello.lisp$ clisp hello.bytecode
Hello, World!!!
$clisp hello.lisp Hello, World!!!$

how can I get these behaviours? Thanks btw: how can i do newlines?

##### Share on other sites
There is bytecode - the files have a "fas" extension. I don't know that you can compile to real binary. You can do "clisp a.lisp" to load and run the code in that file or "clisp a.fas" to run the bytecode in that file or "clisp -c a.lisp" to compile a lisp file to bytecode or "clisp --h" to learn all these.

(format t "~%~%~%") will write three newlines

##### Share on other sites
GNU CLISP uses a bytecode vm. Many other lisps compile to native code. clisp is fast enough for most purposes though. If you want speed don't forget to (compile ...) your functions, else CLISP will have to convert your sourcecode to bytecode everytime you call them.

Creating standalone executables is somewhat complicated. Usually you don't create standalone executables but save an image and distribute the image-loader together with your image and a startscript.

Look here and here.

##### Share on other sites
ok, so why does the above code do this when i load the file
genjix@linux:~/media/programming/clisp> clisp hello.lispWARNING: *FOREIGN-ENCODING*: reset to ASCIIHello, World!!!

I assume it means the encoding of the text file? what encoding should i use?

##### Share on other sites
I'd recommend SLIME for Emacs as IDE for writing Lisp-code.

It makes writing lisp so much easier. Especially the hyperspec lookup, autoindent and parens-matching are indispensable.

1. 1
2. 2
3. 3
4. 4
Rutin
15
5. 5

• 14
• 9
• 10
• 12
• 17
• ### Forum Statistics

• Total Topics
632910
• Total Posts
3009177
• ### Who's Online (See full list)

There are no registered users currently online

×