News for hackers. Stuff that matters.
Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by prospero on Friday August 24, 2012 @05:19PM (#4429744)
Here's an Asteroids clone I wrote in Clojure a few years back, which has less than 400 lines and some neat stuff like procedurally generated 3D asteroids: https://github.com/ztellman/penumbra/blob/master/test/exampl...

Some of the design decisions are discussed in detail at http://ideolalia.com/creating-a-simple-game-in-clojure

Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by fusiongyro on Friday August 24, 2012 @05:36PM (#4429814)
The Lisp code used multiple dispatch to handle collisions between objects, whereas your Clojure code instead uses list comprehensions to generate pairs of colliding objects by type. I know Clojure also supports multiple dispatch, so I'm wondering if you could comment on this design decision.
Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by prospero on Friday August 24, 2012 @06:16PM (#4429976)
The only collisions I care about in my implementation are asteroid/ship and bullet/asteroid, and they're easier to express directly. The OP's version appears to have many more types of collisions, which makes multiple dispatch a more obvious choice.
Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by nemoniac on Saturday August 25, 2012 @07:41AM (#4431809)
Could you update the penumbra README? I'd like to try it out but the instructions are outdated.
Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by prospero on Saturday August 25, 2012 @10:45AM (#4432170)
Outdated how? They were working the last time I made a commit a year ago, I'm not sure what could have changed.
Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by slig on Friday August 24, 2012 @10:08PM (#4430817)
Thanks for the blog post. Very informative and concise.
Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by ken on Friday August 24, 2012 @06:04PM (#4429928)
Looks pretty good overall, but there are a few little oddities.

Not to turn this into a design review, but using EQ to test for 0 seems like it's asking for trouble, and it looks like that * has only one argument.

Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by andyhd on Saturday August 25, 2012 @12:31PM (#4432449)
Thanks for the tip. I didn't realize numbers with the same value could be different to eq.
Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by notJim on Friday August 24, 2012 @05:49PM (#4429863)
It would be incredible to me if someone could write some commentary about this for the non-lisper. Skimming it now, it seems very familiar to me (as in, I don't really see anything about it that expresses anything particularly beautifully), but I might be missing some of the finer points. Overall, I recognize a lot of familiar code that I've written for games in javascript. It's hard to appreciate the aesthetics of this, since I'm not familiar with the language.
Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by aidenn0 on Friday August 24, 2012 @05:55PM (#4429891)
My guess is that the author is new to common lisp. It's the only CL project in his github account, and he wrote it using vim. Most people who have been using SBCL for a while will use emacs with SLIME as it is the recommended IDE for using SBCL.

So I wouldn't expect it to contain any particularly awesome lisp-isms. My first read made me think it was using multiple-dispatch, but it isn't doing so in a way that wouldn't also be possible in a language with overloading, as no more than 1 parameter is ambiguously typed at function call time.

Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by enduser on Friday August 24, 2012 @09:18PM (#4430673)
Some of the best lispers use vim. cf Doug Hotye (antiweb, Let Over Lambda) and Paul Graham. I use vim + slimv to develop with SBCL.
Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by fusiongyro on Friday August 24, 2012 @06:11PM (#4429963)
I think it's a little disingenuous to expect less of someone for using a different editor. Good catch on the multiple dispatch though.
Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by FuzzyDunlop on Friday August 24, 2012 @06:26PM (#4430003)
I think it would be fair to say that the characteristics of the code you write could change depending on whether you use an editor or an IDE though.

If emacs + slime is to lisp what eclipse is to java, then I think that is what the GP was alluding to.

Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by fusiongyro on Friday August 24, 2012 @06:38PM (#4430044)
It makes just as much sense as racial profiling.
Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by rglullis on Friday August 24, 2012 @06:50PM (#4430105)
To avoid the politics: "it makes just as much sense as Bayesian inference".
Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by fusiongyro on Friday August 24, 2012 @06:58PM (#4430136)
I suppose that's better. Great Lispers are statistically unlikely to be using Vim, but the number of people using Vim is so large that merely using Vim isn't damning evidence that code is poorly written.
Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by batgaijin on Friday August 24, 2012 @08:03PM (#4430460)
It's not 'great lispers' it's 'programmers reading lisp tutorials'

If you can find one Lisp tutorial that mentions only Vim or even shows Vim and Emacs as competing setups I would be genuinely surprised.

Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by idoh on Saturday August 25, 2012 @12:19AM (#4431093)
Here is one: http://ycombinator.com/arc/tut.txt

"There are 4 parentheses at the end of that call to cons. How do Lisp programmers deal with this? They don't. You could add or subtract a right paren from that expression and most wouldn't notice. Lisp programmers don't count parens. They read code by indentation, not parens, and when writing code they let the editor match parens (use :set sm in vi, M-x lisp-mode in Emacs)."

Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by PuercoPop on Friday August 24, 2012 @07:05PM (#4430180)
He mentioned the editor second. The fact that it was the only CL project in his github first. In my perspective he mentioned the editor as a weaker circumstantial evidence.
Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by andyhd on Saturday August 25, 2012 @12:27PM (#4432437)
Hi, author here. I am new to Lisp (about 4 months in) and I've been a happy Vim user for many years, so I'm not finding the transition to Emacs very easy. I am trying, though.
Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by aidenn0 on Wednesday August 29, 2012 @07:42PM (#4452086)
I'm a very happy vim user too. Sadly, short of commercial IDEs, developing lisp without slime is like developing Java without eclipse or intellij; it's just an inferior way to interface with the language.

For vim users, the two choices are vim+slimv and emacs+evil. I find evil to be closer to vim than slimv is to a good slime experience, but that can change. Also, if you have any vim plugins that you really depend on then slimv probably edges out evil.

On the other hand I started out several years ago with viper plus a bunch of hand-coded elisp functions to use my most commonly-used vim commands, so we've come a long way.

Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by andyhd on Saturday August 25, 2012 @12:44PM (#4432487)
I was planning to write about my experience writing this, so I'll keep you posted.

It's really not elegant or special code at all, though, just something I used to learn some more about Lisp.

Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by notJim on Saturday August 25, 2012 @08:34PM (#4433891)
Please do!

Lisp has this reputation within the hacker community, and I'd love to hear some impressions from people who are new to it.

Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by rwos on Friday August 24, 2012 @06:53PM (#4430113)
This was on /r/programming and now it's here - I'm sorry, but I don't really understand what this is all about. 600 lines doesn't seem ultra-small to me. And Lisp - well sure, not too common a language for games, but it's not as if this was written in a purely functional style or something. In fact, it looks like pretty standard imperative programming to me - it wouldn't look much different in C.

Am I missing something here?

Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by andyhd on Saturday August 25, 2012 @12:36PM (#4432465)
I wasn't trying to write it in less than 600 lines, that's just what the OP used for an interesting title, I guess.

It's just a fun project I did to learn a bit of CL. I translated the code from a Python game, so it's not in pure functional style. Now that you mention it, though, I feel like I should try that.

Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by justinhj on Saturday August 25, 2012 @12:13AM (#4431087)
Nice to see a project using http://code.google.com/p/lispbuilder/wiki/LispbuilderSDL which wraps the SDL library amongst others and works on Linux, Mac OS X and Windows.
Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by spaninispa on Saturday August 25, 2012 @10:51AM (#4432184)
great!

it's a nice project, it's free, it's modern, it works, it's an interactive-graphic-non-boring thing, it's a game!

lisp needs more of this.

party's open: more functional, macro wiser and skinnier ones are welcome.

vim should be welcome too as I run ASTeroids fine under vim+slimv (just like the terminal) while under emacs+slime it doesn't display some white line segments here and there... (same sbcl for all)

last thing, I scored 3432 (level 11) with the first coin...;)

Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by andyhd on Saturday August 25, 2012 @12:40PM (#4432473)
Thanks for your support! I totally agree with you - I put the code up on Github because I figured someone like me might want to improve it or take it in another direction.
Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by rule30 on Friday August 24, 2012 @07:08PM (#4430202)
no macros? I'm no expert and I'm asking to experts: macros are one of the key features of Lisp. Should macros have helped reducing LOC or improving maintainability?
Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by sp332 on Friday August 24, 2012 @08:24PM (#4430526)
Disclaimer: I'm not a lisper. But according to Paul Graham, Macros are harder to write than ordinary Lisp functions, and it's considered to be bad style to use them when they're not necessary. http://www.paulgraham.com/avg.html
Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by swah on Saturday August 25, 2012 @10:07AM (#4432064)
"If the browser ran bytecodes instead of javascript..."
Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by gawi on Saturday August 25, 2012 @10:49AM (#4432180)
Not even using libasteroid...
Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by sahat on Friday August 24, 2012 @05:12PM (#4429686)
I didn't know what a beautiful code was, until I looked at this project.
Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by andyhd on Saturday August 25, 2012 @12:41PM (#4432477)
Thanks!
Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by prtamil on Saturday August 25, 2012 @01:36PM (#4432624)
I just observed , whenever there is a discussion about Common Lisp , some how somebody would inject something about Clojure. Did anybody noticed that ?
Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by prtamil on Saturday August 25, 2012 @10:25PM (#4434119)
Its simple Logic,

Programmers Those who use C = C Programmers. Scheme = Scheme Programmers. Common Lisp = Common Lisp Programmers. Clojure = Clojure Programmers.

Programmers Who use Clojure != Common Lisp Programmers.

So Please, please stop posting about Clojure in Common Lisp Posts.

I don't want Clojure solution for Common Lisp problem.

Re:Asteroids in under 600 lines of Common Lisp (uses SBCL an... by prtamil on Saturday August 25, 2012 @10:12PM (#4434105)
if I want to eat steak, i'd search about steak, why the hell i need to check about broccoli. Same thing if i want to learn Common Lisp, i need more info about Common Lisp, Why the hell i need info about Clojure.