Tuesday, November 10, 2009

How (un)usable is Scheme?

I am very skeptical of all those new lisp dialects. IMNHO Creating new dialects is more or less like a phase in every lisper's lifetime.

What every lisper ought to do before he dies:
"Plant a tree, write a book, create his own dialect of lisp"

But after I've seen Programming Clojure in the reading list of many fellow lispers I've decided to give it a try. So I went to Clojure download site where I was greeted with an implementation instructions that required me to jump through hoops to make it work and it was an instant turn off. Lack of it-just-works implementation means that this language is still pioneer only and pioneers are the ones with the arrows in the back. So until its ready I'm not touching it.
So what was my choice for my doses of lisping? As I'm growing tired of common lisp funcall which regularly makes my functional code look disgusting I've decided to give a Scheme a try. You've heard about Scheme, don't you? Its a language made by ivory tower academics for the ivory tower academics. Balkanized across various incompatible implementations with incompatible extensions. Seriously is there a language that has more implementations then Scheme? I doubt so. But some brave souls of the Scheme Steering Committee finally showed some mercy for the poor application programmers and voted the R6RS standard that looks usable, well at least on paper.
So I've downloaded PLT Scheme and started working through The Scheme Programming Language. So far things are going well. Luckily PLT has an ability to create executables so I am going to scratch my itch and make a simple expense tracking application for my needs. Let's see how usable Scheme is in the real life.

The problems with Clojure implementations are solved thanks to the nice folks from Enclojure group Netbeans 6.7.1 doesn't load project . After skimming Stuart Halloway Programming Clojure I feel that Rich Hickey approach is visionary and buying Stuart books was a smart choice. I don't believe that common lisp will be replaced by Clojure but rather it will expand the lisp genome to new generation of programmers. Now I would love to buy another two Clojure books Clojure in Action and The Joy of Clojure if Manning is kind enough to list my country in their payment page. So if you love s-expressions and need the benefit of the Java ecosystem give Clojure a chance.

Monday, November 2, 2009

Array languages for Lisp programmers

I've written an article about value of array languages for lisp programmers at vector - journal of the British APL Association. The link is here.

Wednesday, September 30, 2009

Hyperspec treasure: pathname-match-p

There was a great post at pozorvlak about Slava's(*) Haskell challenge. For the lazy here's a little copy paste:

This piece of code goes through a parse tree of Haskell source code, locates every reference to an identifier that ends with "Widget", puts it on a list, and removes duplicates so every identifier is represented in the list only once.

extractWidgets :: (Data a) => a -> [String]
extractWidgets =
nub . map (\(HsIdent a)->a) . listify isWidget
where isWidget (HsIdent actionName)
| "Widget" `isSuffixOf` actionName = True
isWidget _ = False

Steven Apter's q solution was impressive:

a:distinct raze over x
a where a like "*Widget"

So I tried to reproduce it in lisp. Distinct is remove-duplicates, raze is our good friend flatten, but I lacked like. Being lazy I've asked the denizens at c.l.l.(**) for a freebie and they were more then helpful providing plenty of alternatives. Below is Vassil Nikolov solution:

;;; Vassil Nikolov
(defun widgets (tree)
(flet ((widgetp (n &aux (c= #'char-equal))
(zerop (or (mismatch "widget" (string n)
:from-end t :test c=) 0))))
(remove-if-not #'widgetp (flatten tree)))))

Four lines isn't that bad(***) but I still disliked the flat part. Then Dmitriy Ivanov saved the day suggesting pathname-match-p.

(defun like-widget (l)
(lambda (x)
(pathname-match-p (string x) "*Widget"))
(flatten l))))

Clarity improved drastically. Afterwards it was easy, using my golf library and extracting like as general purpose utility I've decreased it into two clear lines.

(defun like (x p)
(apply #'pathname-match-p
(mapcar #'string (list x p))))

(defun widgets (l)
(unique (keep (f like x "*Widget") (flatten l))))

Same number of tokens (11) with Steven Apter solution, but mine having extra parens. The author claims that Lisp is longer and messier than Haskell for easy problems which I disagree with. By programming the programmable language lisper could quickly achieve extreme terseness, or continue to write very long and descriptive names and be faithful to the tradition. But the choice is there, always.

The author of two great lisp libraries:cl-cont & weblocks
Thanks to:Pascal J. Bourguignon, Thomas A. Russ, Mirko Vukovic, Stanislaw Halik and Vassil Nikolov
Due to blogger lousy code formatting some solutions are split to several lines.

Sunday, June 21, 2009

Dissecting a masterpiece

Once in a while I've stumble a code that does what I want but I can't understand how it works. The programming language is right, I know all the operators that are used(*) with everything clear and well formed but the composition is way beyond my limits of comprehension. In that case I know that I've encountered a masterpiece. There is two explanations why I can't get it. I'm either lazy or stupid. Usually I try to fix the first before thinking about the second.
Ten days ago I needed a way of slicing arrays so I asked for advice on cll. Denizens provided me with reference to some nice libraries like Tamas Papp affi & xarray and Marco Antoniotti MAKE-ARRAY-SLICE. However it was Pascal J. Bourguignon that pushed my limits. Here's my code cleared a little bit and using a suit object instead of array for easier printing.
My requirement were creating a function slice that will behave as aref with additional functionality of creating a slice for every non integer index.Example:
For foo being 2 dimensional array (2 5)
0 1 2 3 4
5 6 7 8 9

(slice foo 1 2) <=> (aref foo 1 2)
However for every subscript that's not an integer:
(slice foo 1 t)
5 6 7 8 9

(slice foo t 4)
4 9

There's two great ideas in his solution:
1st Creation of template functions like make-reader that use non integer indices as arguments while the integer indices are prespecified.
2nd Generation of looping construct in make-copier, make-printer & make-writer. This was the hardest problem for me. My approach was making a variations generator and use it indices supplier to aref but this is far better.

Here's how it is used:
(setf foo (make-instance 'suit :array (make-array '(2 3 4))))

(slice foo 1 t 2)

(setf (slice foo 1 t 2) 3)


(slice foo 1 t 2)
3 3 3

(*) Actually almost all of them. This is the first time I've encountered GET-SETF-EXPANSION

Saturday, June 20, 2009

Erik Naggum (1965-2009) RIP

Even his own death provoked a flame war. I doubt that people will ever let him rest in peace but somehow it sounds better then being forgotten. As the opposite of love isn't hate but indifference, even those who don't hold him close to their harts pay a homage to him by mentioning his name.
Farewell Erik, you'll be missed.

Great epitaphs from Pittman, Kjetil, Zach Beane, Ruben and Tobias Rittweiler

Sunday, June 14, 2009

Refactoring : The Silent No

Few months ago I gave a presentation in front of my colleagues. Some of them completely missed it because they've expected something that goes for hour or two and they've were late hoping to skip the part with making projector work and non essential intro. Fortunately for them I've started in time and talked for less then 15 minutes. I mean if that's enough for Dick Hardt why make it any longer.
The theme was something dear to my heart, refactoring. I've had a slideshow with pretty pictures, stole a giggle or two, and got few useful questions when finished. It was a presenters' dream came through. But afterwards I felt something odd, the aftermath of silent no.
What the hell went wrong? My advices were fine, like it sure easier to write a parameterized constructor then burden the class or struct user to manually set them eachtime, or that source control keeps old version of our code so we don't need if (false) ... . But the problem was that those advices were fine for me and people that tend to think like me. The terse language thinkers, but not all coders are molded from a same shape. My ability to reduce line count several times is annoying for some and useless for many. What's wrong with having two simigliar methods rather then adding parameter to merge them? They're doing the same thing aren't they, so whats the point of making it shorter?
I can't speak for everybody else but my reasons for refactoring are practical.I have a small amount of brain cache memory. So the best thing to understand something is a dense writing with descriptive names. If I need to scroll a function there is a good chance to forget what the hell was on the page before while reading the current page. So If you're amount of brain chache is outrageous, good for you. Refactoring is something to be left for the less gifted. But me and likes will have to fallow Ken Iversons' advice he once gave to Fred Brooks(author of The Mythical Man-Month:

If it’s a clause, turn it into a phrase. If it’s a phrase, turn it into an adjective or an adverb. If it’s an adjective or an adverb, omit it. And you apply these recursively.

Thursday, June 11, 2009

Worse is better, but what actually is worse?

Dan Weinrieb touched the most infamous theme in lisp, the historical Worse is Better and how it will repercuse on the future of lisp. I've planned to reply on his blog but the reply got little longer so I'm posting it here.

I can't shrink Richard Gabriel essey but basically it's about Good enough winning over the Right thing thus worse actually being better. So my question is please name the area that lisp is better? And the answer I will receive is probably :
"...Please don't assume Lisp is only useful for Animation and Graphics, AI, Bioinformatics, B2B and E-Commerce, Data Mining, EDA/Semiconductor applications, Expert Systems, Finance, Intelligent Agents, Knowledge Management, Mechanical CAD, Modeling and Simulation, Natural Language, Optimization, Research, Risk Analysis, Scheduling, Telecom, and Web Authoring just because these are the only things they happened to list." - Kent Pitman

Few days ago I was showing weblocks to a fellow Asp.Net programmer. He was impressed by what persistence, continuations and macros could buy him but he wanted a visual builder. After a little explaining of the inflexibility of that approach he was ready to accept lack of drag 'n' drop IF AND ONLY IF the controls he's used to working with from Asp.Net existed in weblocks. And they weren't. Another lost customer. He's doing half a dozen applications a year and his clients think perl is a typo for pearl and python is a snake so they wouldn't care if he writes their apps in whatever language he chooses including the speach defect I mean lisp. For him lisp is clearly worse, by far. It doesn't matter if he could express some weird continuation flow when actually he can't get a little calendar working with little glue code.

My little story tells us that whenever we say lisp is better at everything we actually say we don't have a clue at what the hell is lisp good for. So the more honest wording would be saying that Weblocks as a representative of lisp is better in a systems with most convulated control flow assuming that you're willing to write your own controls, because prefabricated do not exist.

So where is lisp now? My best guess is stuck in the prechasm trying to pass on several different areas. And its not working. Without choosing a beachead and launching invasion we're doomed to frustration. Being a favorite language of early adapters and getting older each day while they look for a newer toys will keep us at being no more death then usual. So if we want to win and get to the pragmatists and later conservatists we need to pick an practical niche and cross the chasm. Else my friend story will stay just one in many.

Wednesday, June 10, 2009

Three Principles of Coding Clarity

Recommended reading of my favourite(*) article from Stephen Taylor Three Principles of Coding Clarity the editor of vector the journal of the British APL Association. Stephen is a really great writer you could and you could enjoy more of his esseys at http://www.5jt.com/articles.php. The Pair Programming With the Users is my second best.

(*) Yes favourite, that's the British english for favorite, and Stephen is British. You don't have to correct my spelling all the time.

Wednesday, June 3, 2009


Row-major-aref is one more prove that common lisp standardization committee did such a great job. A feature that I needed and it was there thanks to John Thingstad for pointing out. Whenever proponents of minimalist languages whine about size of ANSI standard they should read about Simplicity .For the lazy here's my favourite part:

A lot of software developers are seduced by the old ‘80/20’ rule. It seems to make a lot of sense: 80% of the people use 20% of the features. So you convince yourself that you only need to implement 20% of the features, and you can still sell 80% as many copies.

Unfortunately, it's never the same 20%.

Thursday, May 14, 2009

Programming weblocks

It has been more then a year since the time I last worked with weblocks. So I was anxious to see how much the things improved with the latest version. I'm usually working on windows using lispworks so I've unpacked weblocks archive into my Lisp Libraries and expected Edi's starter pack to do its magic. To no avail as asdf failed. It was obvious that weblocks still depends on symbolic links to compile and run. I've did the easiest thing reshuffled some folders so starter pack could find them and weblocks started compiling. Lispworks spewed some errors that I could ignore and after few minutes I was playing with the demo and the blog. Afterward I tried running the tests but exhausted the heap of my personal edition. This was the third bad omen in a single hour so I decided to switch to linux. Luckily new Ubuntu 9.04 recently came out and I already had a virtual machine set up for running it together with sbcl and slime.
Only thing I was missing was clbuild. It took some time to install all dependencies (darcs, svn, hf ) but the process was smooth. With clbuild installed I've downloaded weblocks and clbuild took care about the dependencies. The problem was that when I've started slime and asdf:load-op :weblocks couldn't found the files in the clbuild directories. I was tired to think so instead of pushing a link to asdf directories I just copied at the .sbcl folder. Then I've run the demos and weblocks tests.
I have an application that I make every time I learn a new web UI framework, sort of used cars shop so I started making it with weblocks. To cut on the setup I've copied the weblocks demo files, since it already has the employee functionality. The only thing I needed to change was position class instead of company class. Actually I've tried calling it position but there is already a function with that name so I was forced to change to positions. I've added a class for storing cars and started looking on the prefabricated widgets source to see what else is available.
The login widget was there so I quickly added it and it was time to sleep.
So far Weblocks looks very cool. The author and maintainers did a good job for creating a public consumption ready product.
Unfortunately the number of prefabricated widgets is very far from what I'm used to. So today If times allows will check how easy is to extend it with new types and widgets.

Thursday, May 7, 2009

Lisp outside the Box

It seems that lisp is really coming back this time through the front door. Nick Levine, the author of Fundamentals of CLOS, just announced a new book about lisp, that will be published by O'Reilly.
The common lisp groups in LinkedIn (Common Lisp, Lispniks & LispNYC) are growing fast with many known and new names joining. Anyway Reasoned Schemer was finally delivered so I only need some time to read it. Let see what Kanren could teach me what kind of data should I return in my project.

Tuesday, May 5, 2009

Land of Lisp

Conrad Barski lisper with talent to make funny comics with weird sense of humor seems to be preparing new book Land of Lisp Learn to Program in Lisp, One Game at a Time!. I hope there will be ebook edition this time beside the print. Read first at Nikodemus Siivola blog.

Sunday, May 3, 2009

Rafael Cavallaro again

Second cutting remark by Rafael Cavallaro in c.l.l.

Mark Tarver:
Python does not have much to teach CL as a language; but it does have a lot to teach the CL community as a success story. Guido made some right moves and CL people did not. It is worth reflecting on what he did that made Python such a success.

Rafael Cavallaro:
Aimed low?

Friday, May 1, 2009

Starting with Prolog

I've finished implementation of suciu algorithm complete with tests and must say there is one function with the ugliest lisp code I've ever written.I've planned to test for performance against cl-unification but it would keep me more motivated to start implementing Prolog immediately then improve performance when the library is finished.

Monday, April 27, 2009

Building Common Lisp library

I've talked about the negative impact of hackbraries in my previous blog http://tourdelisp.blogspot.com.It is time to take my own advise and build a lisp library myself. It was a long time ago since I wanted to make portable s-expression syntax prolog,covered with tests, that works out of the box on Windows,Linux at least over the major lisp implementations.Also I want to be modular in order to switch unification functionality if there is better one in the market such as Marco Antoniotti cl-unification And now its a good moment to do it. First I will Implement the algorithm described in Yet Another Efficient Unification Algorithm paper. Then I will start building the actual s-expression syntax prolog.
Suciu algorithm has two steps,parsing terms into unification table then unifying the terms using the table . Thanks to Maciej Katafiasz and Madhu I already had a functions for parsing the unification table, you can see them lisp paste . However both solutions lacked the way or returning the indices of p & q term that are needed in the next step so I wrote parsing unification table functionality from scratch. My solution is probably slower, but Its shorter and easier to understand.Then I've pack everything into asdf file and added another asdf file for the tests. I decided to go with cl-rt test framework since its simple and doesn't have any dependencies. If I need something more complex I'll check other testing frameworks later.
I have enough to cal it a project so lets apply for hosting at common-Lisp.net.

Thursday, April 23, 2009

Reasoned Schemer

I've ordered Reasoned Schemer and waiting for it to come, being in Macedonia it took other Amazon order (Let Over Lambda) nearly 3 months to arrive. I wonder why don't many authors of programming books offer electronic version for sale. They are more convenient to read and try the code plus they don't kill trees? Is it the fear of piracy. If somebody wants to pirate book, it will just scan it and post to internet. I really don't see any point.

Monday, April 6, 2009

lure and bait

I've just canceled my wireless internet contract with T-mobile after just 2 months. Beside the slow internet I got ten times larger bill for my first month for going over my bandwith limit. So I asked them to put a limiter whenever I pass the limit just turn me off, or warn me or whatever. But they just didn't wanted to do it. Instead I got a number to track on my own. So I decided to cancel my subscription. And got charged 6 month bills for doing that. I could think about the way management was thinking for squeezing every bit of money they can, and forgetting about those unimportant things called customer satisfaction. If they were honest and asked for more money up front and offered convenient way to track my spending I would be satisfied and they will earned much more. Now I feel cheated as in classic lure and bait situation. They robbed me but they actually robbed themselves.
I wonder if those penalties payed for canceling the service show up as negative marketing or they're profit as usual. And no matter how many commercials they run and what kind of sponsorship they won't get the money of anybody I know.
And they just have to piss off enough people. There is always a choice.


There are more non-lisp things I want to write about and tourdelisp is lisp focused blog so I decided to move to a new place http://slobodanblazeski.blogspot.com/ . The old content will stay here but there will be no new updates.

Monday, March 30, 2009

Let Over Lambda final review

Yesterday I've finished the rest of the chapters of Let Over Lambda, and my final thoughts are that this book is all about mastering code transformations. Programming in mainstream languages is like attacking problem directly or through a tool usually called library. With metaprogramming things go little bit more interesting. Lisp programmer makes a tool, that makes a tool, that makes a tool that solves the problem. Or as the old saying goes (*):
Lisp programmer available: Will write code that writes code that writes code for food.

Chapter 5 and 6 are my favorite ones, with a lot of useful examples and techniques. The bold statement that lisp isn't functional and we're proud of it certainly rings a bell, though most of the time I prefer functional style and lisp is great vehicle for programming in it. I didn't believe much in optimizations so I don't found much use of chapter 7 that gives you many example how to compile or macro transform your code into ultra efficient, high speed machine code when need arise. Finally book ends with implementing Forth, interesting stack based language, with Lisp . Final chapter felt something like a graduating case study.
Afterwards there is a nice Appendix A of what languages to learn, that I must complement with at least one language of the APL family like J or Q, and Prolog.
Appendix C covers the open source implementations which lisp has certainly has an abundance of high quality ones. But there also commercial ones which offer many additional functionality like high quality implementations of embedded Prolog (lw & acl) and Franz completely in lisp implemented databases: AllegroCache and AllegroGraph .
Appendix D covers *lisp* editors Emacs and Lisp.
My opinion is that on linux slime is the best choice but on windows I prefer commercial ides.
One little thing that bothers me in this book is author naming convention of *avoiding-asterisks-in-globals*. I don't like how some things are named in common lisp, especially I would like shorter names and removing def-something wherever possible, but in order to communicate more clearly with fellow programmers it is better to make a good use of known conventions then to invent new ones.

(*) Thanks to Rob Warnock for posting such wisdom in cll

Any lispers in Africa?

I don't have much time to write this days, I just bought myself a new Peugeot, I'm a sucker for a good design, so only new thing in my blog was adding the visitors map. Judging by the dots, lispers span over all inhabitable continents beside Africa. In all this years in cll I don't remember any member from Africa. If there is one please write.

Friday, March 27, 2009

Don't ask for ideas, ever

Have you ever been to those meetings where the future of something important for your organization is discussed and everybody should propose their ideas regarding it. Maybe the goals is new product, or improvement of existing line, or new ways to cut costs or whatever. So you end up in a meeting with some of your peers, your boss, your boss's boss,and some heavy weights like chairman, important client and the No3 expert in some area in the world, with No1 consulting Cisco exclusively and No2 being semi retired in Bermuda, no phone calls send him the private jet if you want to meet him. So you're there to discuss ideas that all those brave souls submitted, right ? Wrong, its just a waste of time.
In all the formal organizations I've attended to, both commercial and non-profit there are only one ideas who will be accepted. Those who were accepted before the meeting started. That's it. If whoever submits the idea couldn't get it implemented via regular channels the most he could accomplish in such meeting is "I like your idea" and some tapping on the back.
Why is that happening? Because formal organization have hierarchies. By some footsoldiers or corporals submitting their ideas directly to the generals or secretary of defense that hierarchy is broken. And that's not going to happen in normal circumstances. The only exception is where organization is in pain fighting for survival. When everybody knows that hurricane is going to blow us so we better do something or will end up gone with the wind, then hierarchy melts and everybody looks for saviour . The first company I worked for as a transport coordinator didn't implemented any of my ideas for costs savings while business was going well with millions flowing in. But when China entered the WTO and the business was frightened they looked for every solution to stay competitive and implemented everything that could help, pronto.
So if you want new ideas don't bother asking for them, especially not your subordinates? If what you want is cheap and low risk give them the authority to do it themselves, then judge by the results. Something like all those who have ideas for improvements have $1000 budget or week of company time to work on it. For the rest, the expensive ideas or those who pose an alleviated risk its best to let them flow through the regular channels. Whatever they are. They might be bad ideas or bad ideas for your organization. As we all know ideas are worthless, its the execution that makes them matter.

How long could good design carry you?

I'm early adapter about web browsers, always willing to try new ones. I have latest IE, Firefox, Opera, Safari and Chrome on a single machine. Sometimes that latest is not by my choice like with damn IE8 that can not be uninstalled from Windows server, which I certainly want to do because it can not open wikipedia pages from the google search results but instead it's trying to download them as file. Classic showstopper.
Beside IE that I'm required to use for work the rest are my personal preference. And its only one that I'm actively using the rest are just standing there. At first it was Firefox, then I switched to Opera after they added the home button and improved the look with Opera 10. Later I tried Chrome, it was fast and ugly, but the real problem was the address bar being very high on the screen, so whenever I raised the cursor my favorite dock showed up, and that was unacceptable.
Afterward I tried Safari, same problem as with Chrome but I repositioned the dock to the left. Why I was willing to sacrifice convenience and learn a new position for Safari but didn't give a chance to Chrome?
Because Safari looks great. I love the colors I love the effects and I love how the fonts look like and where the buttons are positioned. Safari has many quirks, like saving page together with some ugly bugs like crushing few times a day and especially not saving my files so I'm forced to use Mozilla for downloading videos from keepvid.But I'm willing to live with that because Safari has style.
So how long will good design carry you? It seems that mediocre product with great will win against good product with mediocre design everything else being the same. Being technologically great is tough sale unless end user could perceive that difference very quickly. Else high quality tech product is just another product, and its ugly by the way.
So as long as there are no showstoppers will keep Safari. Until something better comes along.

Monday, March 23, 2009

You wan't a custom web application, specify with the builder

Several years ago everybody wanted to have a web site, with home page, flashy icons, cool logo etc. Now the interactivity is the current buzzword, and everybody and his mother turned to web applications driven by features such as search, comments, forum, widgets and so on.
And the scenario goes like this:
Client wants a custom web application. Sometimes the client makes the specification himself, sometimes hires a professional artist, and sometimes its just copy some competitor app with few tweaks here and there and of course different color scheme. After the spec is carved in stone with all those beautiful features and colors the programmers are hired, more often then not the lowest bidders, and after agreeing on deadline and budget project starts. Several passed deadlines, hugely overblown budget and a 2 teams of programmers later the project is still in a phase of miserable prototype. Client is pissed off and blames the stupid programmers because they didn't implemented the beautiful detailed requirements as specified.
I've seen this happening several times thrugh the eyes of both clients and programmers. And it usually ends with all side dissatisfied.
So the question is how to hire programmer to make your custom web application on time and budget?
1st Find a quality programmer or team leader if the project is larger. Explain roughly what you want, how much you're willing to pay and when you need the project done. Don't go for the cheapest as that will usually leave you with those with least experience and/or skills.
2nd Decide which web framework to use. If you don't know what web framework is think about it as a store with some prefabricated parts. Ask your programmer to tell you to tell you the list of frameworks he's experienced working with and check their web sites so you could see the demos and examples there. If the framework has a visual builder such as Visual Studio he can demonstrate available componenents.
3rd If you can afford it hire a designer too. Very few programmers have both art and functional skills, so without artwork your application will look amateurish at best and ugly at worst.

Now you can start making the specification with both of them on board. Clients knows what he wants or doesn't want. Designer knows what looks good. But its the builder who is crucial for succesful project. As client you may lay as many wishes as you want and designer can make the most beautiful artwork in the world wide web but that's just a dead paper (or pixels) without execution.
What's the catch?
Programmers are actually doing very little programming. Most of the time they're just assembling prefabricated components. The clients and especially designers want something custom, that looks good but its almost unattainable unless you have 7 digit budget. In that case I doubt you would be reading this. Even small changes on some prefabricated component propagates customization or creating a new component altogether that will usually eat the whole budget of every small to medium size project. And that's only for one component. Think of it as ordering a custom car. Designer thinks about drawing some beautiful concept on paper, but builder wants to use as much as possible parts that could be bought cheaply in every parts store. Also those prefabricated parts are battle tested on many cars before, every unique part doesn't have a track record. Do you really want to bet your life on custom brakes just because it looked better or you would rather use someone that were tested on millions of cars before? So if what you want isn't prefabricated ask the programmer if he could make it in a day, if its not ready after a day think of it as separate project and decide do you want to spend resources on it or use
something not quite right but available.

So to summarize:
1. Use prefabricated components from the framework or third party
2. Customize them with artwork through CSS
3. Treat everything that can't be done in a day as a separate project

Sunday, March 22, 2009

First taste of Let Over Lambda by Doug Hoyte

I finally found time for for going through first few chapters of Let Over Lambda so this post will be some sort of prereview, will post the final review as soon as I finish the book.
I'm impressed with Doug Hoyte writing style, he's fallowing the tradition of second to none lisp authors that I first came in contact through David S. Touretzky timeless Gentle Introduction. Doug Hoyte style is clear, concise and full of enthusiasm. I love his words and his examples. Let Over Lambda should be on a shelf of every serious lisper.
1st I would really love if lispers and especially lisp authors stop being smug and avoid Grahamisms like Blurb and top percentile of programmers. There are many highly talented programmers who use 'lesser' languages and are very capable with them. I know that lisp act as a lever increasing programmer capability 3-10 times but that's only for the lisp type of programmers working on lisp friendly projects.
2nd There is no ebook version. Dead tree version of programming books are cumbersome and impractical. Though I love reading real books laying on the bed, working through programming books requires a computer and trying the examples. Also for those happy enough like me that live in Macedonia and like countries keep in mind that I waited 2 months for the book to arrive. If the author decides to put an pdf version (with contents please), under reasonable price I would be very happy to buy the book once more. Plus it would save some trees.

So far this book is great investment and joy to read, It's a real shame that author didn't spend at least a little bit of his time on advertising his book. I know that book is self-published ( through Lulu) but that's a reason more to tell the world about the book himself, posting some notice at places where lispers usually gather like comp.lang.lisp and asking for some linking from authors of lisp related sites and blogs etc won't take much time and would certainly help avoiding the obscurity. If Tamas didn't mentioned Let Over Lambda at cll I wouldn't be aware that such thing exist. Anyway all the lispers that like Let over Lambda ( first 4 chapters are free from the book site) please support Doug Hoyte and spread the word. This book deserves to be famous.

Monday, February 9, 2009

Which Lisp to Learn?

So you decided to learn lisp and you are confused with all those choices.
There's something called Common Lisp (is that for common people only?), than Scheme (Would I become a Schemer?), than Arc, Clojure, NewLisp, Qi and who knows what. So before your head is going to blow your are going to comp.lang.lisp newsgroup and asking for a recommendation. Then the hell opens and your honest question erupted into an ugly flamewar with otherwise mostly good people accusing each other and calling other people ugly names. So while your asking yourself what have you done in your past life to deserve such faith let me explain you a few things. The name lisp is a general name for the lisp family of languages as per John McCarthy wish, the inventor of lisp, lisp should be used as label for the whole family of lisp languages instead of describing just one language. Something like c, c++, c# and java are family of c language & its descendants. That wouldn't be such a huge problem if the ruling patriarch of lisp family, common lisp had it's own newsgroup. Something like comp.lang.common-lisp , but (for unknown reasons) it doesn't. So all the common lisp users, the majority of lispers, dwell on comp.lang.lisp which is generic groups for all lisp family of languages. So your action was like going to generic group for c and c language descendants and asking what language should you learn. Hypothetically you would heard discussion like this :
c-user: Learn c it's the right real thing.
c++-user: No learn c++, c is too low level.
Java-user: No learn Java, it runs everywhere.
c#-user: No learn c#, it has best ide and tail call elimination.
d-user: No learn d, it has the latest and greatest staff.
And then everything will go to hell like:
c-user: c++ is ugly as sin.
c++-user: Java is dog slow.
java-user: c# is microsoftware
c#-user: Java is sunware
...duscussion continues with people calling each other ugly names

Now that you understand what happened let me give you my not so neutral
advice about most popular lisps so you could decide for yourself
which lisp to learn.
1.Common Lisp - It's an industrial strength, multi platform, specified
by ANSI standard lisp. It has the largest active community, many high quality
implementations, huge number of libraries, and enormous amount of material
to learn it even compared with mainstream languages.Also Kent Pittman excellent hyperspec is a first stop shop for any questions regarding Common Lisp.
2. Scheme is the language that started to be minimalistic but it abandoned that way with advent of latest standard. It is more aimed at functional style,and has full blown continuations, something that common lisp lacks. Though it has 2nd only to common lisp community, scheme community is balkanized across different implementations. Scheme has many high quality implementations but the problem is that there is many incompabilities between them since its still de facto standard R5Rs is very small. The latest standard R6RS smooths many incompabilities but it needs time to gain acceptance. Scheme also has huge amount of learning material.And the famous sicp is a must read for every serious lisper, not just schemers.
3. Qi - is a product of Mark Tarver, it introduces powerful static typing system, adapts pattern matching, embedded prolog etc.There is one excellent book by Mark Tarver, Functional Programming in Qi. Little learning material compared with common lisp and scheme. The community is small.Very few libraries, though you could use common lisp ones. Single implementation that runs on top of common lisp.
4. Clojure - Runs on top of JVM. Aimed at functional programming and introduces many novel ideas to support SMP and concurrency. One book, Programming Clojure, spartan reference manual. Little learning material compared with common lisp and scheme. Small community and libraries, though you could use Java libraries. And a single implementation.
5. NewLisp- simple lisp aimed at scripting. Three books and pretty good reference manual . Little learning material compared with common lisp and scheme. Small community and libraries.Single implementation.

If above descriptions of some of the lisps that I more of less tried didn't helped you to make your mind, than my recommendation is to go with common lisp, and then switch if you find other lisp more to your needs. Some lisps offer some new blood, but they all have much to learn to compete with a battle proven beast as common lisp. Though some lisps are better in some areas they are usually far worse in many other areas. In the end It's up to you. And yes I am a common lisper.

Learning common lisp

Everything you need to learn common lisp

There's a plenty material to learn common lisp, with many books and most of them free so If you want to learn you're spoiled of choices. Please note that labeling books as beginner or advanced is somewhat arbitrary as many beginner books have advanced material and many advanced books start with crush course of lisp.Also this is my personal opinion as I don't study in details each book on the list rather skimmed most of them.

Beginner books:
For learning common lisp if you're already experienced in some other
language and you just want to get on creating applications with lisp I would recommend Practical Common Lisp http://www.gigamonkeys.com/book/ free as ebook, worth every cent of the paper edition.

If you're new to programming or just prefer slower pace :
2. Gentle introduction to symbolic computation http://www.cs.cmu.edu/~dst/LispBook/index.html would probably be a great choice. After you finish it you should probably continue with Practical Common Lisp, mentioned above.

The other great free ebooks, some of them offer printed editions are:
3.Succesfull Common lisp http://www.psg.com/~dlamkins/sl/contents.html
4.Loving lisp http://www.markwatson.com/opencontent/
5. COMMON LISP: An Interactive Approach http://www.cse.buffalo.edu/~shapiro/Commonlisp/
6. Basic Lisp Techniques, http://www.franz.com/resources/educational_resources/cooper.book.pdf
Also Great for starters but without free online editions are:
7 Ansi Common Lisp by Paul Graham
8 Lisp by Winston & Horn . This goes in later chapters into AI world.

There's some nice videos that Franz made available free of charge from their certification program at http://www.franz.com/services/classes/download.lhtml

Advanced books:
1. On Lisp: http://www.paulgraham.com/onlisp.html goes into most detail description in art of writing macros.
2. Paradigms of Artificial Intelligence Programming, though aimed at those intersted in AI it teaches Norvig great style of writing programs. Must have for every lisper.
3. Object-Oriented Programming in Common Lisp: A Programmer's Guide to CLOS by Sonya E. Keene teaches the common lisp object system
4. The Art of the Metaobject Protocol by Gregor Kiczales keep this until you're good at CLOS.
5. Let Over Lambda - concentrated on macros, I can't tell you more until my copy arrives.

There is also one book that you will heard that people recommend quite often: Structure and Interpretation of Computer Programs, by Abelson, Sussman, and Sussman. It's great book but it's not a common lisp book but in other language called Scheme. Though I recommend it to read it, if you decided to learn common lisp please read it after you feel comfortable with common lisp. Else you're going to just end up confused.

Choosing implementation for learning purposes is a non-issue. Common Lisp is specified by standard and all implementations must adhere to it so just pick up
whatever you find close to your preferences and previous knowledge. You can switch at anytime you want. If you're expecting Visual Studio or Eclipse like ide probably Allegro http://www.franz.com/downloads/ and Lispworks http://www.lispworks.com/downloads/ will serve you best. If you want open source, SBCL www.sbcl.org and Clozure CL http://openmcl.clozure.com/ are widely used. Scieneer http://www.scieneer.com/ is I heard best at SMP. If you're concentrated on portability CLisp www.gnu.org/software/clisp/ is your pick. Armed Bear http://armedbear.org/ is dedicated for running on JVM and ECL is embeddable ecls.sourceforge.net/ . There is also CMU CL www.cons.org/cmucl/ and Corman Cl http://www.cormanlisp.com/
All of them with do just fine for learning common lisp beside GNU CL(GCL) which I don't recommend, not to be confused with GNU CLisp.
For more detailed info check Dan's survey http://common-lisp.net/~dlw/LispSurvey.html .

Thursday, January 22, 2009


Again those newbies who barely know anything about common lisp yet they criticize it or make new *improved dialects*. I should avoid them, but I can't. I enjoy batting them. Anyway Raffael Cavallaro gave me a great laugh:
On 2009-01-21 22:01:41 -0500, Majorinc Kazimir said:
> Newlisp is designed to be simple
...minded? (**)
Raffael Cavallaro, Ph.D.

This an old compilation of rules how to become role model lisper:
1. Don't learn (*)lisp
2. Troll in comp.lang.lisp (check Gavino for examples)
3. Spam in comp.lang.lisp ( check our resident spammer for examples)
4. If you really decided to learn lisp. Learn some vapourware,
abandonware or marginalisedware lisp.
5. Don't do any search before you ask questions that were answered
for at least 100000000000000000 times before.
6. If any of the seasoned lispers get's mad because you asked a
question that was already answered for at least 100000000000000000
times before, start a blog whining about savages of comp.lang.lisp,
prefarably comparing it with eagle-scout community of you-name-it
7. If you really started learning common lisp, stop at day two and
whine all the way long in this newsgroup how ugly it is.
8. Continue with lecturing Kent Pittman, Guy L. Steele, and the rest
of the ANSI committee what they were thinking while designing common
lisp and show them the right way it should be done.BTW I've heard
rumours that they were drank all the way through standardisation
process, and rolled dice whenever there was a dispute what features
would get in the standard.
9. Never do any programming in lisp, just hang up in c.l.l all day
long and brag nonsense
10. If you're really must program in lisp, do it like with your
previous favorite language, compiling files through command line,
loading scripts etc. Those things worked great with c and php what
the hell they shouldn't do the same with lisp?
11. Don't listen to experienced lispers. What the hell do they know
what you don't after using lisp for 50 years?
12. Criticize authors of lisp books, especially those who made their
books available as free downloads.
13. Don't buy lisp books.
14. Whine about how all the free lisp implementations suck and commercial lisp are overpriced piece of shit.
15. Be abusive & unhelpful to newbies
16. Don't write lisp libraries.
17. Whine how lisp lacks libraries in your favorite area.
18. If libraries you need exists, whine how low quality are they.
19. Don't bother to send bug reports to library authors, if they were
smart enough they would figure it out themselves.
20. Even if library you need exists, with good quality and under
acceptable license ,don't use it . Start from scratch creating your
own masterpiece.

(*) Whenever I say lisp in this newsgroup I mean common lisp. For
other meaning I use lisp family of languages
(**) I was amuzed by Raffael timeless reply not by technical discussion, here's Kazimir reply for those who want to go into details.