Thursday, November 16, 2006

Most people who criticize Lisp don't understand it

Disclaimer: I don't program in Common Lisp these days and I don't claim to speak for the Lisp community at all, however I think I do know the Lisp language reasonably well.

Just looking the last few weeks of postings on reddit related to Lisp, people raise the following objections:
  • Lisp does not interface with the C-based world easily, unlike scripting languages -- this is clearly false, since most Lisp implementations have easy to use FFIs. To bind a C library to Ruby, you have to write C code which glues the library to the Ruby runtime system. With CFFI (which is portable across CL implementations), you just list the function prototypes in your Lisp file and you're ready to go. You can also pass structs, etc. Factor's C library interface works the same way.

  • Common Lisp was designed to perform well on Lisp machines only, and makes no concessions to ordinary computers. - this is partially true, but the CL standard did omit some features found on Lisp machines which would be difficult to implement efficiently on conventional hardware. However none of this can change the fact that Common Lisp implementations are an order of magnitude faster than scripting languages.

  • Look at all these parentheses! - of course if you don't need metaprogramming, macros, and code-as-data, may as well not use Lisp.


There are many other common misconceptions. The "Lisp only supports linked lists" and "Lisp is unsuitable for writing real-world programs" memes seem to have died down in the last few years, but more myths have taken their place. This leads me to believe that the main problem the Lisp community faces to ensure wider adoption (assuming wider adoption is what they want, which is not necessarily the case) is not a technical one, or an internal social problem as some suggest, but rather an education problem.

Most people simply don't know anything about Lisp, but feel qualified to discuss it and criticize it. Like I said, I'm not a member of the Lisp community (whatever that may be), but when advocating Lisp, Lispers should remember that a lot of things that they take for granted (sane language semantics, C library interface that works, metaprogramming, good performance from a high-level language) are completely foreign to most programmers! There's a communication gap.

And to all the programmers learning new languages, not just specifically Lisp, please hold off criticism until you know the language and have completed a significant project in it. If you did not get that far, don't criticize the language, and put it down to lack of time, lack of motivation or personal failing.

I can rag on Java all I want because I know it better than most Java advocates. But if you were first exposed to Lisp 2 weeks ago, then don't make yet another blog posting about parentheses, even if you work for Google. You're just wasting bandwidth.

Wednesday, November 15, 2006

Archaic Factor screenshots

Factor's UI has come a long way since the early days:

Some features were abandoned:

Doug Coleman's weblog

Doug Coleman now has a weblog. His first entry talks about compiling Factor on Windows from darcs. This involves setting up ssh, darcs, and msys.

Reminder: Factor talk in Montreal

I will be presenting Factor at the Montreal Scheme/Lisp User's Group next Wednesday, November 22nd.

I'm slowly putting together a presentation. Slides are defined using Factor help markup using a custom stylesheet, and everything is displayed by the Factor UI. So far I have 248 lines of code, most of which is the markup for slides. I'll put it in examples/mslug-talk when it is done.

Tuesday, November 14, 2006

Factor 0.86 released

Version 0.86 of the Factor programming language is now out.

Windows and Mac Intel packages were provided courtesy of Doug Coleman (thanks Doug!)

Changes:


+ Core
- Improved memory management code leads to reduced memory consumption, less frequent garbage collections and fixes a few corner cases where Factor could run out of heap even if a GC would have freed enough memory to proceed
- Improved prettyprinter low lays out code in a more pleasing manner
- Windows native I/O has been sped up (Doug Coleman)

+ UI
- Double and triple clicks are now recognized, and can be used to select text in the editor gadget
- Windows now update while being resized on Windows

+ Stack effect inference
- The new infer. word should be called instead of infer, since it presents information in a more pleasing way
- Stack effect inference now infers variables read and written by a quotation to facilitate code comprehension and debugging

+ Module system
- The syntax for PROVIDE: has changed, consult the documentation
- Modules can now provide a main entry point, see run-module and MAIN:
- Modules can now provide documentation, see Documenting modules

+ Contributed libraries
- New contrib/cpuinfo (Doug Coleman)
- Updated contrib/match (Chris Double)
- Updated contrib/parser-combinators (Chris Double)
- Updated contrib/postgresql (Doug Coleman)
- Updated contrib/process (Doug Coleman)
- Updated contrib/sqlite (Doug Coleman)
- Updated contrib/textmate (Benjamin Pollack)
- Updated contrib/tuple-db (Doug Coleman)
- Updated contrib/vim (Doug Coleman)
- Updated contrib/xml (Daniel Ehrenberg)

Haar wavelet transform in Factor

Here is the Haar wavelet transform implemented in Factor. This is only the 1-dimensional version:
: averages ( seq -- seq )
[ first2 + 2 / ] map ;

: differences ( seq averages -- differences )
>r 0 <column> r> [ - ] 2map ;

: haar-step ( seq -- differences averages )
2 group dup averages [ differences ] keep ;

: haar ( seq -- seq )
dup length 1 <= [ haar-step haar swap append ] unless ;

Sunday, November 12, 2006

Some developer tools in the incubator

I have a small file of "work in progress" developer tools which I'm not releasing yet, which so far includes:
  • Calls in/out at the vocabulary level, rather than individual words
  • Finding words which read or write a given variable
  • Shortest path between two words
  • Searching for unloaded modules on disk

Some of these will eventually make it into the core. I also want to develop a graphical cross-referencing tool in the UI which combines various words one can invoke in the listener into one coherent interface.