Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Samith

Hello World in Lisp

This topic is 5321 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''m using Corman Lisp as my compiler/interpretter/LISP thing, and I want to make a hello world program, like....an actually executable and everything. Basically, my problem is that I don''t know how to compile. This is what my source code looks like:
(defun main ()
    (print (''hello)))

(main)

(save-application "hello.exe" ''main)
Pretty simple looking, but it doesn''t work at all. Well, maybe it does, and I just can''t tell. Anyway, what''s happening is I''m getting a huge 1.1mb exe that does nothing. I run it (from the command line, just to make sure it''s not starting up and then closing faster than I can see it) and it does....well....nothing! So if anyone knows what I''m doing wrong, your help would be great, thanks.

Share this post


Link to post
Share on other sites
Advertisement
I''ve never done an .exe with Lisp, but I question: why do you have (main)? Isn''t that like calling main during the start-up phase?

Anyway, you would need to open up a window or a console to actually see something, I believe. I don''t know how to do that, but there are ways to access the Win32 API from Lisp. You can call any C function, in fact. Look at the help.

If you want a simpler deal, write your Hello World to a file instead.

Cédric

Share this post


Link to post
Share on other sites
(print "hello world")


That should be sufficient for lisp.

You can expect a large executable.

Also- why don''t you get clisp?
Its the standard.

I would expect compiling syntax would be....

c:>lisp -o hello.lsp
(compiling messages if errors/warnings)
c:>

Might be -c or something, but it should approximate that.

Anyway: in future, ask lisp questions in the AI forum- they speak with a lishp over there.

Share this post


Link to post
Share on other sites
I suspect the problem is that you're not passing enough parameters to the (save-application) function.
quote:
Corman Lisp documentation
SAVE-APPLICATION application-name start-function [function] &key (console nil) (static nil)
(emphasis mine)

I think you probably just need to put true in for the console parameter.
I'm only getting this from the docs though, not from experience, so I might be wrong.

quote:
Original post by Vlion
Anyway: in future, ask lisp questions in the AI forum- they speak with a lishp over there.

Actually, it's probably better to ask AI questions in the AI forum, and lisp questions in the general programming forum. That way, the names of the forums will actually be related to their content.

John B

[edited by - JohnBSmall on February 28, 2004 9:30:37 PM]

Share this post


Link to post
Share on other sites
I''m not a LISP expert, BUT one rule of thumb for LISP ==

1) YOU CAN NEVER HAVE TOO MANY PARENTHESIS ( ( ) )!

Dam you Lisp and your evil ways!

Also, Hello World is not what Lisp is really about ... Learn List Comprehension

"Arguing on the Internet is like winning in the Special Olympics, in the end, you''''re still retarded"

Share this post


Link to post
Share on other sites

(defun main ()
(print "Hello World!")
(force-output))
(save-application "d:\\1\\hello" ''main :console t :static t)


It took me a while until I found the force-output function in some examples in the corman lisp program directory.

The original post has a few errors. First, you should have written (print ''hello). By writing (''hello) you try to call the hello symbol as a function - which is wrong. Also you don''t need to execute the function main - third line - (main).

I added the :console t key parameter to say that I want a console app and the :static t one to make sure no Corman Lisp dll is required to run the program. There''s also a path for the resulting exe file - you may want to change that.

Share this post


Link to post
Share on other sites

  • 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!