Jump to content
  • Advertisement
Sign in to follow this  
Genjix

clisp beginner questions

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
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.lisp
WARNING: *FOREIGN-ENCODING*: reset to ASCII
Hello, World!!!

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!