The Common Lisp stuff now works passably well for prototyping, though it's 
nowhere *near* as mature as the Scheme implementation.  Until someone creates a 
*real* Common Lisp implementation, we at least have a prototype that'll work 
for some purposes.

Below are some results after running some tests to see if the Common Lisp stuff 
*could* be used (it can).

--- David A. Wheeler


To test out the Common Lisp stuff,  I snagged the Common Lisp source code from:
  http://norvig.com/paip/README.html
and ran this:
  ./diff-s-sweet -C -w paip/*.lisp

This program's "-w" option is primarily to help you find s-expressions that 
aren't well-formatted, but it also helps to test "unsweeten"'s Common Lisp 
implementation.

Unsurprisingly, nearly all Common Lisp code (at least, in this sample) is also 
well-formed.   In the guile test suite, *EVERY* file in the test suite was 
well-formed.  In the Common Lisp set, I did find a few exceptions, though they 
were rare:
* In a few places it uses "f(x)" to mean the two datums "f (x)".  This is in a 
section where it tries to process lists that are math expressions.  Of course, 
in sweet-expressions f(x) is (f x). This turns out to be rare, unsurprisingly, 
and easily fixed in the few places they occur by inserting a space between "f" 
and "(x)".  The whole point of that code is to try to simulate a notation that 
in my opinion is better handled with sweet-expressions... so in fact that whole 
section of code could disappear.
* In a few places there are multiple datums on one line, esp. in grammar.lisp 
where there are a number of declarations about words (multiple declarations are 
put on a line).  Inserting 1+ spaces in front of the line fixes this 
completely, and it actually doesn't happen very often.

I also found a few weaknesses in its handling of Common Lisp, which *could* be 
fixed:
1. The sequence ".," is currently interpreted as a symbol (as does guile!), 
which isn't correct for Common Lisp:
(defun make-clause (clause)
  "Translate a message from define-class into a case clause."
  `(,(first clause) #'(lambda ,(second clause) .,(rest2 clause))))
That could be fixed in our reader, but for the moment, it doesn't seem worth 
the trouble.
2. The |...| is consumed by the reader, and not printed back out later, so |.| 
is mis-interpreted later as the set-cdr operator in "examples.lisp" section 
"(defexamples 7 ...".

It's a rough count, but there are 11738 lines in this sample code set (per wc 
-l paip/*.lisp); note that is *not* pretty-printed.  The # of lines of code 
where there were problems, was 197 (per ./diff-s-sweet -C -w paip/*.lisp | grep 
'^- ' | wc -l), which is 1.7%.  Generally the problem was that one construct, 
say ".,", would cause an entire datum to fail, so it's not as bad as it looks.  
It's basically a very small set of lines that have to be changed before nearly 
all of them can be read as-is.


------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Readable-discuss mailing list
Readable-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/readable-discuss

Reply via email to