Lisp Pimpin'

Started by
387 comments, last by Mercury 18 years, 7 months ago
Quote:Original post by Max_Payne
Well, considering I'm mostly interested in graphics and 3D engines, you'd have to convince me that lisp can help me write simple, clean and very efficient code.

I don't really have to convince you. Effectively, we're doing you a favor by spending time trying to convince you to take the time and enlighten yourself. You can treat it as free career counseling. That's how I prefer to think about the discussions I've had with Lispers when I was in your shoes.

[smile]
Advertisement
Quote:Original post by CoffeeMug
Quote:Original post by Max_Payne
Well, considering I'm mostly interested in graphics and 3D engines, you'd have to convince me that lisp can help me write simple, clean and very efficient code.

I don't really have to convince you. Effectively, we're doing you a favor by spending time trying to convince you to take the time and enlighten yourself. You can treat it as free career counseling. That's how I prefer to think about the discussions I've had with Lispers when I was in your shoes.


"Enlighten" eh?

As it was said before, you Lisp people should start a religion or something ;)

And well, I don't think you ever were in my shoes.

The main reason I'm not convinced, is that I don't really feel like theres a problem in the first place. The thing I feel is most uncomfortable in C++ is the lack of support for multithreading and other important OS-dependent facilities in the standard libraries.

Looking for a serious game project?
www.xgameproject.com
On a side question, can you recommend a Lisp/Scheme implementation suitable as an extension language for games? I have looked into Guile, but I am not sure if this is the best thing for the task.
Quote:Original post by Max_Payne
"Enlighten" eh?

I can't describe the experience of grokking Lisp in any other way. Learning it is very frustrating until a certain "ohhh shit..." experience at which point you experience a certain feeling not unlike nirvana.
Quote:Original post by Max_Payne
And well, I don't think you ever were in my shoes.

Considering I've used the same exact arguments as you are now, I think I was in your shoes at least as far as the topic of discussion is concerned.
Ok. I wrote some code in Lisp to simplify sprite animation. The following code will move *sprite* to a random location every 0.5 seconds for a total of 5 seconds.

(animate *sprite*	 (init ((random-jump (make-instance 'random-jump					    :max-x 418					    :max-y 320))))	 (cue (and (every 500) (until 5000))	      (action random-jump *sprite*)))


That's it.

[Edit - added the following explanation]

Some explanation:

'animate' is called every game loop. However everything in 'init' is only called once. Here we use 'init' to create the 'random-jump' action - this must be done the first time 'animate' is run.

'cue' is run for each game loop. 'cue' checks that the following are true before running the action:

- 'every' returns true every x milliseconds.
- 'until' retuns true until > x milliseconds.

Quote:Original post by CoffeeMug
I can't describe the experience of grokking Lisp in any other way. Learning it is very frustrating until a certain "ohhh shit..." experience at which point you experience a certain feeling not unlike nirvana.


The Lisp will make you happy. The Lisp will make you beautiful. Now, let us all medidate in front of the holy Lisp statue.

Quote:Considering I've used the same exact arguments as you are now, I think I was in your shoes at least as far as the topic of discussion is concerned.


Considering many of my arguments are responses to your own arguments, that wouldn't make much sense ;)

Looking for a serious game project?
www.xgameproject.com
Quote:Original post by Konfusius
On a side question, can you recommend a Lisp/Scheme implementation suitable as an extension language for games?

I would suggest rolling your own. Writing Lisp interpreters is frankly extremely easy. If you know Lisp barely, I'd suggest this as well. As long as you use trivial Lisp principles you'll end up designing the language. You'll find that your design will end up very similar to the actual Lisp design as there is a natural way to do things (to which you'll arrive on your own). That will increase your understanding of Lisp tremendously. I really recommend taking the time to do it. It'll be worth it many times over.
Quote:Original post by Max_Payne
Quote:Considering I've used the same exact arguments as you are now, I think I was in your shoes at least as far as the topic of discussion is concerned.

Considering many of my arguments are responses to your own arguments, that wouldn't make much sense ;)

? I'm talking about me arguing against Lisp a couple of years ago same way you're doing now.
Quote:Original post by CoffeeMug
I would suggest rolling your own.

Thank you. I will give it a shot.
Quote:Original post by CoffeeMug
Quote:Original post by Konfusius
On a side question, can you recommend a Lisp/Scheme implementation suitable as an extension language for games?

I would suggest rolling your own. Writing Lisp interpreters is frankly extremely easy. If you know Lisp barely, I'd suggest this as well. As long as you use trivial Lisp principles you'll end up designing the language. You'll find that your design will end up very similar to the actual Lisp design as there is a natural way to do things (to which you'll arrive on your own). That will increase your understanding of Lisp tremendously. I really recommend taking the time to do it. It'll be worth it many times over.


I think thats a neat idea as far as learning is concerned (I am tempted to try it :D).

However, if you are concerned with speed, you should at least need to compile the Lisp code into a simple AST.

Looking for a serious game project?
www.xgameproject.com

This topic is closed to new replies.

Advertisement