Author: Tord Romstad
Date: 02:21:33 02/18/04
Go up one level in this thread
Hi Vincent, Some comments and explanations below: On February 17, 2004 at 19:33:52, Vincent Diepeveen wrote: >Let's start the functional programming subject. Why? Lisp is not a functional programming language, although it allows you to write programs in a functional style if you want. Functional programming is not the only, nor even the most common style of programming in Common Lisp. >Have you ever written a serious application in LISP? Yes. I worked three years as a full-time Lisp programmer in Telenor, the leading Norwegian telecom company. This was huge, multi-layered and multi-threaded server applications central to all Telenor's activities as an Internet service provider. The applications were used, directly or indirectly, by about one million Norwegian customers every day, in addition to lots of employees in Telenor. Briefly explained, the main tasks of the applications were to administrate Telenor's databases of customers, accounts, products and services, automatically distribute all changes in user configuration to those systems which needed to be aware of them, real-time rating of Internet connections and all other volum-based Internet services (as well as mobile phone calls and some other non-Internet-related volume-based stuff), as well as billing the customers. Because of the application's central importance in Telenor and the huge number of simultaneous users, performance and stability were extremely important. 100% uptime was a very important requirement. Hence the ability to modify and upgrade the programs while they were running was essential. Concerning your problems with the syntax: The syntax is fully programmable. Common Lisp readtables are first-class objects, and can be copied, manipulated and hacked any way you want. Common Lisp is a language construction kit just as much as a language. The reason why the default syntax looks the way it is is that keeping the base syntax as simple and fluid as possible makes it easier to build new languages on top of it. It is easy (trivial, in fact) for a Lisp program to write Lisp code, precisely because of the syntax. As I have tried to explain (probably in a clumsy way) elsewhere in the thread, the most common way to write big and complicated programs in Lisp is to build a domain-specific language on top of Lisp, and write the final program in this language. This language does not need to resemble Lisp at all. >((((((((((a b c)(a))))))(((())))))(((()))) > >Sentences like above are not so easy to understand. C is way easier. But the line of Lisp "code" above doesn't do anything. It isn't code at all in any meaningful sense of the word. I would even claim that you would never even see anything like the above line in a Lisp program, unless it is written by an incompetent Lisper or it is deliberately obfuscated. But you are right that one of the strengths of Lisp, which it shares with C, is that it allows you to write incredibly obfuscated code if you want to. As a curiosity which some people may find amusing (at least I did the first time I saw it), I provide the following bilingual program (the first line in the program should be blank): t(setq /*;*/){}main(){char q='\"',s='\\';char*a= "~%t(setq /*;*/){}main(){char q='~A';char*a= ~S;char*b=/* )(setq a ~S) (setq */ ~S;printf(b,s,q,s,s,q,a,q,q,s,s,s,q,s,s,s,s,q,q,b,q/* )(format t /* a /* a */);}~%";char*b=/* )(setq a "\\\"',s='\\\\") (setq */ " t(setq /*;*/){}main(){char q='%c%c',s='%c%c';char*a= %c%s%c;char*b=/* )(setq a %c%c%c%c%c',s='%c%c%c%c%c) (setq */ %c%s%c;printf(b,s,q,s,s,q,a,q,q,s,s,s,q,s,s,s,s,q,q,b,q/* )(format t /* a /* a */);} ";printf(b,s,q,s,s,q,a,q,q,s,s,s,q,s,s,s,s,q,q,b,q/* )(format t /* a /* a */);} Believe it or not, this program compiles in C as well as Lisp, and has precisely the same effect in both languages: It prints out its own source code (in other words, it is what is usually called a Quine). >AFAIK only some grey old emacs fans write their stuff in LISP. Emacs Lisp is an old, ugly and inefficient Lisp dialect, and doesn't really belong in this discussion. >When i define something in LISP there i continuesly make (((()))((())) >mistakes. I suppose it happens that I misplace a paren too when writing Lisp, but it happens no more often than that I forget a semicolon when writing C. And when I do misplace a paren, at least the error is easy to fix: I just press C-M-q, and it is immediately obvious exactly where the error is. But of course, you need a Lisp-aware editor in order to write and edit Lisp code efficiently. Tord
This page took 0.01 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.