From: Pascal Costanza
Subject: v1.4 of my highly opinionated Lisp guide
Date: 
Message-ID: <3l7bguF113m87U1@individual.net>
Hi folks,

Version 1.4 of my highly opinionated guide to Lisp is available at 
http://www.pascalcostanza.de/lisp/guide.html

The changes are listed at http://www.pascalcostanza.de/lisp/changelog.txt


Cheers,
Pascal

-- 
In computer science, we stand on each other's feet. - Brian K. Reid

From: ········@gmail.com
Subject: Re: v1.4 of my highly opinionated Lisp guide
Date: 
Message-ID: <1122926234.890224.132730@o13g2000cwo.googlegroups.com>
Hi Pascal,

One of the changes noted in the changelog is "deleted the link to the
Lisp 1.5 manual (not available anymore)". There are PDF versions of the
LISP 1.5 Programmers Manual as well as the LISP 1.5 Primer available on
the following page:
http://community.computerhistory.org/scc/projects/LISP/book/

--
Bill Clementson
From: Pascal Costanza
Subject: Re: v1.4 of my highly opinionated Lisp guide
Date: 
Message-ID: <3l7eqjF10utphU1@individual.net>
········@gmail.com wrote:
> Hi Pascal,
> 
> One of the changes noted in the changelog is "deleted the link to the
> Lisp 1.5 manual (not available anymore)". There are PDF versions of the
> LISP 1.5 Programmers Manual as well as the LISP 1.5 Primer available on
> the following page:
> http://community.computerhistory.org/scc/projects/LISP/book/

Yes, I know. That link is included in the guide.


Thanks,
Pascal

-- 
In computer science, we stand on each other's feet. - Brian K. Reid
From: Peter Scott
Subject: Re: v1.4 of my highly opinionated Lisp guide
Date: 
Message-ID: <1122928113.016255.166560@f14g2000cwb.googlegroups.com>
You mention "By the way, the Condition system could also be a basis for
Aspect-Oriented Programming, without the need to go meta!"; did you do
that with AspectL?

-Peter
From: Pascal Costanza
Subject: Re: v1.4 of my highly opinionated Lisp guide
Date: 
Message-ID: <3l7hauF11fdjmU1@individual.net>
Peter Scott wrote:
> You mention "By the way, the Condition system could also be a basis for
> Aspect-Oriented Programming, without the need to go meta!"; did you do
> that with AspectL?

No, that was just meant as a hint towards potential uses of the 
condition system. There are some aspect-oriented approaches that use 
events at specified places in the code to trigger the execution of 
aspect code, and you could do something similar with conditions (not 
errors) in Common Lisp. Since CL conditions don't automatically wind up 
the stack but let the condition handler choose to do so, such a 
condition handler could actually consist of aspect code and a subsequent 
return to the place where the condition was signalled.

AspectL uses the CLOS metaobject protocol to implement aspect-oriented 
features, which is a different approach. My gut feeling tells me that 
the CLOS MOP is a better basis to do aspecty stuff, but I haven't really 
explored this further.

Apart from that, by now I think that aspect-oriented programming (as in 
joint points + pointcuts + advices) doesn't really make sense in Common 
Lisp in the first place. Pointcuts work, kind of, in Java-like languages 
because they use wildcards to pick out methods based on their names, 
which makes sense to a certain degree for the very simple reason that 
Java programmers indeed use naming conventions to encode meta 
information about their source code (set* for setters, get* and is* for 
getters, etc.). Common Lisp provides two very powerful mechanisms for 
meta programming, namely macros and the CLOS MOP, that are both more 
powerful and more "direct" in their use of meta information.

Currently, aspect-oriented approaches seem to move towards using meta 
annotation facilities (as in C# or Java JDK 5.0) instead of relying on 
name patterns. A somewhat recent article by Gregor Kiczales discusses 
the relationship between meta annotations and similar facilities in 
Lisp. To me, this sounds more and more that AspectJ becomes more or less 
a disguised macro facility for a language with an irregular syntax.

See http://www.sdmagazine.com/documents/s=8993/sdm0405h/ for the article 
by Gregor Kiczales.


Pascal

-- 
In computer science, we stand on each other's feet. - Brian K. Reid
From: Pascal Bourguignon
Subject: Re: v1.4 of my highly opinionated Lisp guide
Date: 
Message-ID: <87hde9a0j2.fsf@thalassa.informatimago.com>
Pascal Costanza <··@p-cos.net> writes:

> Hi folks,
>
> Version 1.4 of my highly opinionated guide to Lisp is available at
> http://www.pascalcostanza.de/lisp/guide.html
>
> The changes are listed at http://www.pascalcostanza.de/lisp/changelog.txt

The LISP 1.5 manual is still available.  For example:

http://community.computerhistory.org/scc/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf

from:

http://community.computerhistory.org/scc/projects/LISP/index.html#LISP_I_and_LISP_1.5_for_IBM_704,_709,_7090_


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

This is a signature virus.  Add me to your signature and help me to live
From: Pascal Costanza
Subject: Re: v1.4 of my highly opinionated Lisp guide
Date: 
Message-ID: <3l7f83F11cl5dU1@individual.net>
Pascal Bourguignon wrote:
> Pascal Costanza <··@p-cos.net> writes:
> 
> 
>>Hi folks,
>>
>>Version 1.4 of my highly opinionated guide to Lisp is available at
>>http://www.pascalcostanza.de/lisp/guide.html
>>
>>The changes are listed at http://www.pascalcostanza.de/lisp/changelog.txt
> 
> 
> The LISP 1.5 manual is still available.  For example:
> 
> http://community.computerhistory.org/scc/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf
> 
> from:
> 
> http://community.computerhistory.org/scc/projects/LISP/index.html#LISP_I_and_LISP_1.5_for_IBM_704,_709,_7090_

OK, I see now how my wording in the changelog can be confusing. I have 
changed it to make it clearer that I only meant the HTML version. (But I 
won't add a meta-changelog. ;)


Pascal

-- 
In computer science, we stand on each other's feet. - Brian K. Reid
From: Emre Sevinc
Subject: Re: v1.4 of my highly opinionated Lisp guide
Date: 
Message-ID: <87d5owvan7.fsf@ileriseviye.org>
Pascal Costanza <··@p-cos.net> writes:

> Hi folks,
>
> Version 1.4 of my highly opinionated guide to Lisp is available at
> http://www.pascalcostanza.de/lisp/guide.html
>
> The changes are listed at http://www.pascalcostanza.de/lisp/changelog.txt

Thank you very much for updating the guide (and
by the way giving me an opportunity for another late night 
Lisp hacking session (replace-all *pascal* "quicly" "quickly") :)

I hope you'll have the opportunity to check the Turkish
translation. I have no doubt your guide is going to be
very good reading for Turkish speaking Lisp enthusiasts.


-- 
Emre Sevinc

eMBA Software Developer         Actively engaged in:
http:www.bilgi.edu.tr           http://ileriseviye.org
http://www.bilgi.edu.tr         http://fazlamesai.net
Cognitive Science Student       http://cazci.com
http://www.cogsci.boun.edu.tr
From: Pascal Costanza
Subject: Re: v1.4 of my highly opinionated Lisp guide
Date: 
Message-ID: <3l95puF11l916U1@individual.net>
Emre Sevinc wrote:
> Pascal Costanza <··@p-cos.net> writes:
> 
>>Hi folks,
>>
>>Version 1.4 of my highly opinionated guide to Lisp is available at
>>http://www.pascalcostanza.de/lisp/guide.html
>>
>>The changes are listed at http://www.pascalcostanza.de/lisp/changelog.txt
> 
> Thank you very much for updating the guide (and
> by the way giving me an opportunity for another late night 
> Lisp hacking session (replace-all *pascal* "quicly" "quickly") :)

Come on, that typo occurs only once. No need to write a program for 
that... ;-)

But I didn't realize that I use that word so often... ;)

> I hope you'll have the opportunity to check the Turkish
> translation. I have no doubt your guide is going to be
> very good reading for Turkish speaking Lisp enthusiasts.

I am looking forward to this.


Pascal

-- 
In computer science, we stand on each other's feet. - Brian K. Reid
From: Emre Sevinc
Subject: Re: v1.4 of my highly opinionated Lisp guide
Date: 
Message-ID: <8764uo34iq.fsf@ileriseviye.org>
Pascal Costanza <··@p-cos.net> writes:

> Emre Sevinc wrote:
>> Pascal Costanza <··@p-cos.net> writes:
>>
>>>Hi folks,
>>>
>>>Version 1.4 of my highly opinionated guide to Lisp is available at
>>>http://www.pascalcostanza.de/lisp/guide.html
>>>
>>>The changes are listed at http://www.pascalcostanza.de/lisp/changelog.txt
>> Thank you very much for updating the guide (and
>> by the way giving me an opportunity for another late night Lisp
>> hacking session (replace-all *pascal* "quicly" "quickly") :)
>
> Come on, that typo occurs only once. No need to write a program for
> that... ;-)

Right, it was just a single typo, the main thing was love for Lisp
hacking; I forgot about the article and start going around HyperSpec,
#lisp, CLtL2, etc. 


> But I didn't realize that I use that word so often... ;)

Just another type of information for author detection (hmm,
maybe an opportunity for a cl-authordetect lib. that uses state-of-the-art
AI for guessing the original author of the text? I'm sure
somebody has tackled that before :)


Happy hacking,

-- 
Emre Sevinc

eMBA Software Developer         Actively engaged in:
http:www.bilgi.edu.tr           http://ileriseviye.org
http://www.bilgi.edu.tr         http://fazlamesai.net
Cognitive Science Student       http://cazci.com
http://www.cogsci.boun.edu.tr
From: Pascal Bourguignon
Subject: Re: v1.4 of my highly opinionated Lisp guide
Date: 
Message-ID: <87mzo04g23.fsf@thalassa.informatimago.com>
Emre Sevinc <·····@bilgi.edu.tr> writes:
> Just another type of information for author detection (hmm,
> maybe an opportunity for a cl-authordetect lib. that uses state-of-the-art
> AI for guessing the original author of the text? I'm sure
> somebody has tackled that before :)

There is probably more advanced stuff but this is simple:


;;****************************************************************************
;;FILE:               author-signature.lisp
;;LANGUAGE:           Common-Lisp
;;SYSTEM:             Common-Lisp
;;USER-INTERFACE:     Common-Lisp
;;DESCRIPTION
;;    
;;    This program compute an "author signature" from a text.
;;    See: http://unix.dsu.edu/~johnsone/comp.html
;;    
;;AUTHORS
;;    <PJB> Pascal Bourguignon
;;MODIFICATIONS
;;    2003-03-13 <PJB> Creation.
;;BUGS
;;LEGAL
;;    GPL
;;    
;;    Copyright Pascal Bourguignon 2003 - 2003
;;    ··········@informatimago.com
;;    
;;    This program is free software; you can redistribute it and/or
;;    modify it under the terms of the GNU General Public License
;;    as published by the Free Software Foundation; either version
;;    2 of the License, or (at your option) any later version.
;;    
;;    This program is distributed in the hope that it will be
;;    useful, but WITHOUT ANY WARRANTY; without even the implied
;;    warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
;;    PURPOSE.  See the GNU General Public License for more details.
;;    
;;    You should have received a copy of the GNU General Public
;;    License along with this program; if not, write to the Free
;;    Software Foundation, Inc., 59 Temple Place, Suite 330,
;;    Boston, MA 02111-1307 USA
;;****************************************************************************


(DEFUN STREAM-AS-STRING (STREAM)
  "
RETURN:  A string containing all the character read from the stream.
"
  (LOOP WITH RESULT = ""
        WITH EOLN = (FORMAT NIL "~%")
        FOR LINE = (READ-LINE STREAM NIL NIL)
        WHILE LINE
        DO (SETQ RESULT (CONCATENATE 'STRING RESULT LINE EOLN))
        FINALLY RETURN RESULT)
  );;STREAM-AS-STRING


(DEFUN REMOVE-PONCTUATION (TEXT)
  "
RETURN: A copy of the text string where all character not alphanumeric is
        replaced by a space.
"
  (SETQ TEXT (COPY-SEQ TEXT))
  (LOOP FOR I FROM 0 BELOW (LENGTH TEXT)
        FOR CH = (CHAR TEXT I)
        DO (UNLESS (ALPHANUMERICP CH) (SETF (CHAR TEXT I) #\SPACE)))
  TEXT
  );;REMOVE-PONCTUATION


(DEFUN SPLIT-WORDS (TEXT)
  "
RETURN: A list of words read from the text.
"
  (WITH-INPUT-FROM-STRING
   (IN (REMOVE-PONCTUATION TEXT))
   (LET ((RESULT  ())
         (CH (READ-CHAR IN NIL NIL)))
     (LOOP WHILE CH DO
           (LOOP WHILE (AND CH (EQL #\SPACE CH)) ;;skip spaces
                 DO (SETQ CH (READ-CHAR IN NIL NIL)))
           (LOOP WHILE (AND CH (NOT (EQL #\SPACE CH)))
                 COLLECT CH INTO WORD
                 DO (SETQ CH (READ-CHAR IN NIL NIL))
                 FINALLY (WHEN (< 0 (LENGTH WORD))
                           (PUSH (MAKE-ARRAY (LIST (LENGTH WORD))
                                             :ELEMENT-TYPE 'CHARACTER
                                             :INITIAL-CONTENTS WORD) RESULT)))
           )
     (NREVERSE RESULT)))
  ) ;;SPLIT-WORDS


(DEFUN TALLY-WORD-LENGTHS (WORD-LIST)
  "
RETURN: An array containing the number of words of each length (in
        slot 0 is stored the number of words greater than (length result),
        and (length word-list).
"
  ;; max word length in French: 36.
  (LET* ((MAX-LEN 36)
         (TALLY (MAKE-ARRAY (LIST (1+ MAX-LEN))
                            :ELEMENT-TYPE 'FIXNUM
                            :INITIAL-ELEMENT 0))
         )
    (LOOP FOR WORD IN WORD-LIST
          FOR LEN = (LENGTH WORD)
          FOR COUNT = 0 THEN (1+ COUNT)
          DO
          (IF (< MAX-LEN LEN)
            (INCF (AREF TALLY 0))
            (INCF (AREF TALLY LEN)))
          FINALLY RETURN (VALUES TALLY COUNT)))
  );;TALLY-WORD-LENGTHS


(DEFUN TALLY-SMALL-WORDS (WORD-LIST)
  "
RETURN: An array containing the number of occurences of a list of
        small words returned as third value.
        The second value is (length word-list).
"
  (LET* ((SMALL-WORDS '("A" "BUT" "IN" "NO" "OUR" "THE" "US"
                        "WE" "WHICH" "WITH"))
         (MAX-LEN (LENGTH SMALL-WORDS))
         (TALLY (MAKE-ARRAY (LIST (1+ MAX-LEN))
                            :ELEMENT-TYPE 'FIXNUM
                            :INITIAL-ELEMENT 0))
         )
    (LOOP FOR WORD IN WORD-LIST
          FOR COUNT = 0 THEN (1+ COUNT)
          FOR POS = (POSITION WORD SMALL-WORDS :TEST (FUNCTION STRING-EQUAL))
          DO
          (IF POS
            (INCF (AREF TALLY (1+ POS)))
            (INCF (AREF TALLY 0)))
          FINALLY RETURN (VALUES TALLY COUNT SMALL-WORDS)))
  ) ;;TALLY-SMALL-WORDS


;; (TALLY-SMALL-WORDS (SPLIT-WORDS (WITH-OPEN-FILE (IN "~/tmp/misc/test.txt" :DIRECTION :INPUT) (STREAM-AS-STRING IN))))


(DEFUN TALLY-PERCENT (TALLY COUNT)
  (LET ((RESULT  (MAKE-ARRAY (LIST (LENGTH TALLY))
                             :ELEMENT-TYPE 'FLOAT
                             :INITIAL-ELEMENT 0.0)))
    (DO ((I 0 (1+ I)))
        ((<= (LENGTH TALLY) I) RESULT)
      (SETF (AREF RESULT I) (COERCE (/ (AREF TALLY I) COUNT) 'FLOAT))))
  );;TALLY-PERCENT


(DEFUN MODULE (VECTOR)
  "
RETURN:  The module of the vector. [ sqrt(x^2+y^2+z^2) ]
"
  (SQRT (APPLY (FUNCTION +)
               (MAP 'LIST (FUNCTION (LAMBDA (X) (* X X))) VECTOR)))
  ) ;;MODULE


(DEFUN TALLY-COMPARE (TALLY-1 TALLY-2)
  "
RETURN:  The module and the vector of percentages of differences
         between vectors tally-1 and tally-2.
"
  (ASSERT (= (LENGTH TALLY-1) (LENGTH TALLY-2)))
  (LET ((DIFFERENCES (MAKE-ARRAY (LIST (LENGTH TALLY-1))
                                 :ELEMENT-TYPE 'FLOAT
                                 :INITIAL-ELEMENT 0.0)))
    (DO* ((I 0 (1+ I))
          (D) (M))
        ((<= (LENGTH DIFFERENCES) I))
      (SETQ D (ABS (- (AREF TALLY-1 I) (AREF TALLY-2 I)))
            M (MAX (AREF TALLY-1 I) (AREF TALLY-2 I)))
      (SETF (AREF DIFFERENCES I) (IF (= 0.0 M) M (COERCE (/ D M) 'FLOAT))) )
    (VALUES (MODULE DIFFERENCES) DIFFERENCES))
  );;TALLY-COMPARE


(DEFUN COMPARE-TEXTS (PATH-LIST TALLY-FUNCTION)
  (LET ((TALLIES ()))
    (MAPC
     (LAMBDA (PATH)
       (WITH-OPEN-FILE (INPUT PATH  :DIRECTION :INPUT)
         (PUSH (CONS (NAMESTRING PATH)
                     (MULTIPLE-VALUE-BIND (TALLY C)
                         (FUNCALL TALLY-FUNCTION 
                          (SPLIT-WORDS (STREAM-AS-STRING INPUT)))
                       (TALLY-PERCENT TALLY C))) TALLIES)))
     PATH-LIST)
    (DO* ((T1 TALLIES (CDR T1))
          (N-TALLY-1 (CAR T1) (CAR T1))
          (TALLY-1 (CDR N-TALLY-1) (CDR N-TALLY-1)) )
        ((NULL T1))
  
      (DO* ((T2 (CDR T1) (CDR T2))
            (N-TALLY-2 (CAR T2) (CAR T2))
            (TALLY-2 (CDR N-TALLY-2) (CDR N-TALLY-2)) )
          ((NULL T2))

          (MULTIPLE-VALUE-BIND
           (M D) (TALLY-COMPARE TALLY-1 TALLY-2)
           (FORMAT T "~20A ~20A ~8A~%   ~A~%~%"
                   (CAR N-TALLY-1) (CAR N-TALLY-2) M D))
        ))
    TALLIES)
  );;COMPARE-TEXTS


;; (COMPARE-TEXTS (DIRECTORY "i-*.txt") (FUNCTION TALLY-WORD-LENGTHS))
;; (COMPARE-TEXTS (DIRECTORY "i-*.txt") (FUNCTION TALLY-SMALL-WORDS))

;; (TALLY-COMPARE
;;  (MULTIPLE-VALUE-BIND (TALLY C)
;;      (TALLY-WORD-LENGTHS (SPLIT-WORDS STR))
;;    (TALLY-PERCENT TALLY C))
;;  (MULTIPLE-VALUE-BIND (TALLY C)
;;      (TALLY-WORD-LENGTHS (SPLIT-WORDS STR2))
;;    (TALLY-PERCENT TALLY C)))
  
;;;; author-signature.lisp            -- 2003-04-08 04:27:29 -- pascal   ;;;;

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
The rule for today:
Touch my tail, I shred your hand.
New rule tomorrow.