Hacker News new | past | comments | ask | show | jobs | submit login

I've just started really trying to dig into Lisp. I've got a long way to go, so please excuse me for my ignorance.

Could a modern day operating system be written in Common Lisp? Could highly numeric code (for quant work) run as fast as C/C++?




A modern day operating system has been written in Lisp. If you're talking about x86, there is Movitz as proof of concept, but there is more to "operating system" than a bootstrapped self-hosted shell.

http://en.wikipedia.org/wiki/Movitz

Regarding high performance numeric code in CL, you have the whole of Richard Fateman's career and body of work to peruse. Recently, Didier Verna did a few awesome things:

http://www.lrde.epita.fr/~didier/research/verna.06.imecs.pdf http://www.lrde.epita.fr/~didier/research/verna.06.labri-sli...

There was an awesome report from a boutique audio shop that produces gear for audiophiles; they were doing some realtime stuff and they pushed LispWorks harder than anyone I know. Too bad can't think of their name atm.


Old trusty google told me this: http://www.lispworks.com/success-stories/ral-siglab.html (Refined Audiometrics Laboratory). Is it the one?


Yes it is. Xach summed up the beautiful saga here:

http://xach.livejournal.com/199225.html

Epic! :-)


Could a modern day operating system be written in Common Lisp? Yes.

Could highly numeric code (for quant work) run as fast as C/C++?

Yes, outside of extream optomizations. A good rule of thumb might be if you are are using inline ASM then no, otherwize yes.

PS: Common LISP is not the fastest LISP dielect, for quant work you might want something custom like GOAL. (http://en.wikipedia.org/wiki/Game_Oriented_Assembly_Lisp)


PS: Common LISP is not the fastest LISP dielect, for quant work you might want something custom like GOAL.

Telling the man to implement his own programming language isn't very helpful now is it?

Stock Trading.

http://www.lispworks.com/success-stories/netfonds-primetrade...

Realtime DSP in Lisp for missile defense

http://www.lispworks.com/success-stories/raytheon-siglab.htm...

Signal Processing in audiometrics.

http://www.lispworks.com/success-stories/ral-siglab.html

Franz (makers of Allegro Common Lisp) have even more testimonials.

http://franz.com/success/

There is more to life than reinventing the wheel; sometimes you just wanna get things done.


I did not mean that he had to build it, just that CL is not the fastest LISP dialect out there. You need to sacrifice a few features when looking for stupid levels of speed. Still you can can use a LISP for this stuff even if it's not CL.


Keep in mind that GOAL was designed for deployment on a game console. Also, a lot of the bottle-neck issues that games face are not the same as in high performance, number crunching finance software. Games are graphics, I/O and event processing heavy. In addition, games are compile once and give it to thousands of people type software. While analysis software is often writen once, but tweaked and updated by the end user very frequently. Common Lisp would be just perfect for this type of two stage explore/optimize usage; the development environment is posh, and the performance can get as raw as you want it to be.


My intentions for playing with the language is to rewrite enough of QuantLib, a large library I feel comfortable with, for myself using Lisp so that I can eventually run an equivalent of the Equity Options Example found in the source download. It's just learning at this point, taking something I know and rewriting it in a different language in order to get to know the language better. It will take some time.


What is the problem with inline assembly? Ever heard of LAP (Lisp Assembly Program)? It appeared in Lisp 1.5 and today every decent Common Lisp has one. The sickest one is in Corman Lisp's, where all I had to do was put parenthesis around Win32 NASM code and the fucker ran it.)


IMO, if you are going to sprinkle ASM thought the program, because it really needs to be that fast then CL is probably not the best LISP dialect for you. It's just a rule of thumb and if you only care about speed for a tiny inner loop than CL is still a great choice, but if most of the app needs to be stupid fast consider your options.


Have you heard of FFIs? Foreign function interfaces? You can call ANY OS system call from Lisp, and for user-mode shared libraries you can just load them and call their functions just as easily.

http://www.sbcl.org/manual/Step_002dBy_002dStep-Example-of-t...


Yes.

Look for some applications your code needs to be as fast as possible. When your company is writing the software and spending 50million / year on HW taking a slight speed hit to use your favorite tool is not always an option.

PS: Consider how much money Honda spends on processing power for their engines and how much a 5% speed hit would cost them to fix by buying better HW.


Trent, tried to reply to you in your other post in this thread but it doesn't seem to a "reply" link (weird.)

wrt to http://quantlib.org/reference/_equity_option_8cpp-example.ht...

It should be fairly straightforward to implement enough of Quantlib in Common Lisp IF you are able to implement the same algorithms in any other language. The data structures and data types can be mechanically converted (the Lisp numeric tower if far richer than C++'s numeric capabilities and it might obviate some things) however, it's the numeric algorithms that require expertise to reimplement. A 1:1 translation wouldn't produce an attractive result.

By algorithms I mean stuff like the monte-carlo constructors, MakeMCEuropeanEngine, etc.

The rest of the stuff would look far more attractive in Common Lisp. deftype can tidy up type definitions. The lisp pretty printer and the format function look way more compact than those huge blocks of cout, etc.

One way I can think of is to create C wrappers for C++ and call those wrappers from Lisp. You might have to struggle with Boost, templates and other design patterny crap tacked onto C++ though :-( one way I know is to reify template arguments into function arguments. e.g:

new BinomialVanillaEngine<JarrowRudd>(bsmProcess,timeSteps)

==>

binomial_vanilla_engine (JARROW_RUDD, bsm_process, time_steps)


The financial engineering is not a problem at all. I just asked the two questions that spawned these posts because I was interested in what type things Lisp was being used for. Google and Wikipedia are good, but not nearly as helpful as a direct answer from some people responding directly to questions I've posted.

I spent a good deal of last year and most of this year ripping apart both GSL and QuantLib in an effort to teach myself numerical programming. My plan is to just keep pace in Lisp with my MSFE program. Since at least the first few months of the program are likely to cover things I already feel comfortable with, the plan is--listen in lecture-->go home and code it up.


Brent, if you're good with GSL and basic numeric analysis, take a look at CL-GSL:

http://common-lisp.net/project/cl-gsl/

other stuff

http://www.cliki.net/Mathematics

Feel free to ask me privately for any help you might need, there is also the #lisp channel on freenode.

Fun times are ahead :-)

Cheers!




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: