From: ············@gmail.com
Subject: Where To Begin
Date: 
Message-ID: <1140470007.451038.212560@f14g2000cwb.googlegroups.com>
I've recently become interesting in trying to learn a bit about Lisp.

For the mean time, I'd like to go into things without purchasing
anything. I'm working through Peter Seibel's tutorial at
www.gigamonkeys.com using SLIME and Allegro; however, I feel as though
another introductory level publication and a reference source would be
useful.

Does anyone have a reccomendation for introductory tutorials or
references?

Thank you

-Joe

From: Eric Lavigne
Subject: Re: Where To Begin
Date: 
Message-ID: <1140472191.210467.176520@g44g2000cwa.googlegroups.com>
············@gmail.com wrote:
> I've recently become interesting in trying to learn a bit about Lisp.
>
> I'm working through Peter Seibel's tutorial at
> www.gigamonkeys.com using SLIME and Allegro
>
> Does anyone have a reccomendation for introductory tutorials or
> references?
>

The HyperSpec makes a good reference:

http://www.lisp.org/HyperSpec/FrontMatter/index.html

Introductory tutorials? I used PCL (which you are already using) and
Paul Graham's Ansi Common Lisp (costs some money, which you said isn't
acceptable). If you really need another free source of introductory
reading, you could take a look at Touretzky's book. I haven't read it
myself so can't say how good it is.
http://www.cs.cmu.edu/~dst/LispBook/

You could also check out Structure and Interpretation of Computer
Programs if you don't mind being confused by the differences between
Common Lisp and Scheme.
http://mitpress.mit.edu/sicp/

Yes I know that sounds weird. Studying the wrong language... My first
Lisp book was the Little Lisper, a Scheme book. My first Lisp compiler
was CLisp, a Common Lisp compiler. This led to some confusion at first,
since I didn't realize that I was mixing languages... but it worked
out. The two languages really are that similar.
From: sross
Subject: Re: Where To Begin
Date: 
Message-ID: <1140475559.272226.108450@z14g2000cwz.googlegroups.com>
I can highly recommend Touretzky's book for anyone not
accustomed to Common Lisp. It was the first lisp book I read and
while it can move a bit slowly at times I think it gives an
excellent introduction to basic lisp techniques.

It does leave out CLOS but then PCL handles that more
than adequately, and then of course there is On Lisp
<http://paulgraham.com/onlisp.html> for really getting to
grips with macros, although that is considered a more advanced text.

Cheers,
 Sean.
From: ·······@gmail.com
Subject: Re: Where To Begin
Date: 
Message-ID: <1140472423.911358.227960@z14g2000cwz.googlegroups.com>
············@gmail.com wrote:
> I've recently become interesting in trying to learn a bit about Lisp.
>
> For the mean time, I'd like to go into things without purchasing
> anything. I'm working through Peter Seibel's tutorial at
> www.gigamonkeys.com using SLIME and Allegro; however, I feel as though
> another introductory level publication and a reference source would be
> useful.
>
> Does anyone have a reccomendation for introductory tutorials or
> references?
>
> Thank you
>
> -Joe

I find that Peter Seibel's Chapter 3 trips up a lisp noobie like
myself.  I wouldn't have wasted as much time trying to figure out
Macros on my own if that chapter was after Chapter 8, for example.  But
it is a great introduction otherwise.

As a fellow lisp-noobie (6 weeks under my belt), I found Paul Graham's
ANSI Common Lisp and Peter Norvig's Paradigms of Artificial
Intelligence Programming helpful.

For me, Norvig's explanations were far more clearer and concise, but
Graham covers a lot of the innerworkings of lisp which is also
important.  Finding difficulty in choosing one, I'd recommend both at
the same time.  Graham's ACL has a pretty decent reference of Common
Lisp functions at the end (about 100 pages) while Norvig's PAIP has a
lot of AI info so both are good references.

HTH,
From: Eric Lavigne
Subject: Re: Where To Begin
Date: 
Message-ID: <1140473365.876027.290500@z14g2000cwz.googlegroups.com>
> As a fellow lisp-noobie (6 weeks under my belt), I found Paul Graham's
> ANSI Common Lisp and Peter Norvig's Paradigms of Artificial
> Intelligence Programming helpful.

I agreed with both of those when I was starting out, around a year ago,
and I still like them both now. I still keep Paul Graham's book by my
side as a reference while programming, and I've checked out Norvig's
book several times from the library (inter-library loan, it isn't
available locally). These are both great books.

> For the mean time, I'd like to go into things without purchasing anything.

On the other hand, it looks like both books are out of your price
range. I think they are worth buying, but Practical Common Lisp and the
Hyperspec will be enough if that's all you can afford. Good luck with
your studies.
From: Bob Felts
Subject: Re: Where To Begin
Date: 
Message-ID: <1hb2j9a.10yitsk1v2iz5oN%wrf3@stablecross.com>
<············@gmail.com> wrote:

> I've recently become interesting in trying to learn a bit about Lisp.
> 
> For the mean time, I'd like to go into things without purchasing
> anything. I'm working through Peter Seibel's tutorial at
> www.gigamonkeys.com using SLIME and Allegro; however, I feel as though
> another introductory level publication and a reference source would be
> useful.
> 
> Does anyone have a reccomendation for introductory tutorials or
> references?
> 

Like you, I started with Seibel's tutorial.  I switched to Touretzky's
"Common Lisp: A Gentle Introduction to Symbolic Computation"
(http:http://www.cs.cmu.edu/~dst/LispBook/) and am now in chapter 13.
In the meantime, I've started reading Norvig's "Paradigms of Artificial
Intelligence Programming : Case Studies in Common Lisp" and I purchased
the dead tree version of Seibel's book.  I'll resume with PCL when I
finish all the exercises in Touretzky's book.

I'm finding Lisp to be frustratingly beautiful; frustrating because I'm
sure there are ways of doing simple things that I haven't learned yet:
for example, just today, I had to ask about how to comment about blocks
of Lisp code; and surely there is a better way to convert from an ASCII
digit to a number than (- (char-int c) (char-int #\0)).  And I find the
notation needed to access an element of an array within a structure can
result in a lot of typing compared to other languages.  I find the Lisp
DO function sometimes tricky to get right:  especially when an update
clause needs a variable that hasn't yet been defined.

But Lisp is certainly more beautiful than anything I've used before.
The company I work for has started introducing PSP (Personal Software
Process) in some of our groups; part of the training consists in writing
a number of programs, compiling metrics, and using the metrics to
improve your estimation skills.  The first program took 185 lines of C
(including comments); it was 12 lines in Lisp.

 
From: ········@gmail.com
Subject: Re: Where To Begin
Date: 
Message-ID: <1140484968.446493.299570@g14g2000cwa.googlegroups.com>
Bob ha escribo
>for example, just today, I had to ask about how to comment about blocks
>of Lisp code; and surely there is a better way to convert from an ASCII
>digit to a number than (- (char-int c) (char-int #\0)).

READ-FROM-STRING (with *read-eval* @ nil)

>          And I find the
>notation needed to access an element of an array within a structure can
>result in a lot of typing compared to other languages.

Not sure what you mean. A structure with an array for a slot? Or just
the slot accessor...

You can always

(defstruct (hebetudinous (:conc-name he))
  vector!
  ray!)

and your accessor becomes HERAY!

or use CLOS to roll your own accessors

>  I find the Lisp
>DO function sometimes tricky to get right:  especially when an update
>clause needs a variable that hasn't yet been defined.

That's what recursion, LOOP, DOLIST, DOTIMES, etc are for ;-)

>But Lisp is certainly more beautiful than anything I've used before.
>The company I work for has started introducing PSP (Personal Software
>Process) in some of our groups; part of the training consists in writing
>a number of programs, compiling metrics, and using the metrics to
>improve your estimation skills.  The first program took 185 lines of C
>(including comments); it was 12 lines in Lisp.

Well good luck with your studies

Nick
From: ··············@hotmail.com
Subject: Re: Where To Begin
Date: 
Message-ID: <1140494767.916505.80100@g43g2000cwa.googlegroups.com>
········@gmail.com wrote:
> Bob ha escribo
> >for example, just today, I had to ask about how to comment about blocks
> >of Lisp code; and surely there is a better way to convert from an ASCII
> >digit to a number than (- (char-int c) (char-int #\0)).
>
> READ-FROM-STRING (with *read-eval* @ nil)

NO. #'digit-char-p  (digit-char-p char &optional radix) => weight

  (digit-char-p #\8) => 8
  (digit-char-p #\A 16) => 10  (i.e. hex digits)

#'digit-char does the reverse (digit-char weight &optional radix) =>
char

  (digit-char 9) => #\9
  (digit-char 10 16) => #\A
From: Bob Felts
Subject: Re: Where To Begin
Date: 
Message-ID: <1hb323n.sxf0rpkd87uqN%wrf3@stablecross.com>
··············@hotmail.com <············@gmail.com> wrote:

> ········@gmail.com wrote:
> > Bob ha escribo
> > >for example, just today, I had to ask about how to comment about blocks
> > >of Lisp code; and surely there is a better way to convert from an ASCII
> > >digit to a number than (- (char-int c) (char-int #\0)).
> >
> > READ-FROM-STRING (with *read-eval* @ nil)
> 
> NO. #'digit-char-p  (digit-char-p char &optional radix) => weight
> 
>   (digit-char-p #\8) => 8
>   (digit-char-p #\A 16) => 10  (i.e. hex digits)
> 
> #'digit-char does the reverse (digit-char weight &optional radix) =>
> char
> 
>   (digit-char 9) => #\9
>   (digit-char 10 16) => #\A

Thanks!
From: Pascal Bourguignon
Subject: Re: Where To Begin
Date: 
Message-ID: <87irr9wb66.fsf@thalassa.informatimago.com>
···············@hotmail.com" <············@gmail.com> writes:

> ········@gmail.com wrote:
>> Bob ha escribo
>> >for example, just today, I had to ask about how to comment about blocks
>> >of Lisp code; and surely there is a better way to convert from an ASCII
>> >digit to a number than (- (char-int c) (char-int #\0)).
>>
>> READ-FROM-STRING (with *read-eval* @ nil)
>
> NO. #'digit-char-p  (digit-char-p char &optional radix) => weight

But this doesn't do the same thing.  
DIGIT-CHAR-P converts a character to a decimal digit weight.

Bob wanted to convert an ASCII code to a number. 
This can be done simply with: 

(defun ascii-code-p (code &optional (radix 10))
   (cond ((< 1 radix 11) 
          (when (<= 48 code (+ 47 radix)) 
            (- code 48)))
         ((<= 11 radix 36)
          (cond ((<= 65 code (+ 55 radix)) (- code 55))
                ((<= 97 code (+ 87 radix)) (- code 87))
                (t nil)))
         (t (error "Invalid radix ~S" radix))))
                                                                
                                                                

[13]> (ascii-code-p 65 1)

*** - Invalid radix 1
The following restarts are available:
ABORT          :R1      ABORT
Break 1 [14]> :a
[15]> (ascii-code-p 65 37)

*** - Invalid radix 37
The following restarts are available:
ABORT          :R1      ABORT
Break 1 [16]> :a
[17]> (ascii-code-p 65 16)
10
[18]> (ascii-code-p 49)
1
[19]> (ascii-code-p 32)
NIL
[20]>                                                                 
                                                                

You may want to use:

(defun char-ascii (ch)
  (check-type ch character "CHAR-ASCII expects a character")
  (cond ((eql ch #\Newline)  10)
        ((eql ch #.(ignore-errors (read-from-string "#\\Rubout")))   127) 
        ((eql ch #.(ignore-errors (read-from-string "#\\Page")))      12) 
        ((eql ch #.(ignore-errors (read-from-string "#\\Tab")))        9) 
        ((eql ch #.(ignore-errors (read-from-string "#\\Backspace")))  8) 
        ((eql ch #.(ignore-errors (read-from-string "#\\Return")))    13) 
        ((eql ch #.(ignore-errors (read-from-string "#\\Linefeed")))  10)
        ((+ 32 (position ch " !\"#$%&'()*+,-./0123456789:;<=>·@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" :test (function char=))))
        (t (error "Character ~C has no ASCII code" ch))))

to be able to call: 

(list (ignore-errors (ascii-code-p (char-ascii #\4)))
      (ignore-errors (ascii-code-p (char-ascii #\4))))
--> (4 NIL)



But note that #+clisp (digit-char-p #\4) --> 4
so perhaps the constraint on ASCII is not what you want?

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
Until real software engineering is developed, the next best practice
is to develop with a dynamic system that has extreme late binding in
all aspects. The first system to really do this in an important way
is Lisp. -- Alan Kay
From: Bob Felts
Subject: Re: Where To Begin
Date: 
Message-ID: <1hb497l.1wu4oipnz6m9sN%wrf3@stablecross.com>
Pascal Bourguignon <······@informatimago.com> wrote:

> ···············@hotmail.com" <············@gmail.com> writes:
> 
> > ········@gmail.com wrote:
> >> Bob ha escribo
> >> >for example, just today, I had to ask about how to comment about blocks
> >> >of Lisp code; and surely there is a better way to convert from an ASCII
> >> >digit to a number than (- (char-int c) (char-int #\0)).
> >>
> >> READ-FROM-STRING (with *read-eval* @ nil)
> >
> > NO. #'digit-char-p  (digit-char-p char &optional radix) => weight
> 
> But this doesn't do the same thing.  
> DIGIT-CHAR-P converts a character to a decimal digit weight.

DIGIT-CHAR-P seems to do exactly what I wanted... #\0 -> 0,
#\1 -> 1, #\9 -> 9, #\- -> nil

> 
> Bob wanted to convert an ASCII code to a number. 
> This can be done simply with: 
> 
> (defun ascii-code-p (code &optional (radix 10))
>    (cond ((< 1 radix 11) 
>           (when (<= 48 code (+ 47 radix)) 
>             (- code 48)))
>          ((<= 11 radix 36)
>           (cond ((<= 65 code (+ 55 radix)) (- code 55))
>                 ((<= 97 code (+ 87 radix)) (- code 87))
>                 (t nil)))
>          (t (error "Invalid radix ~S" radix))))
>                                                                 
>  

But this only works if code is of integer type.  My input data is
standard-char.  It was getting standard-char to be it corresponding
integer that was the original problem.  (- (char-int c) (char-int #\0))
was my original solution.
                                                               
> 
> [13]> (ascii-code-p 65 1)
> 
> *** - Invalid radix 1
> The following restarts are available:
> ABORT          :R1      ABORT
> Break 1 [14]> :a
> [15]> (ascii-code-p 65 37)
> 
> *** - Invalid radix 37
> The following restarts are available:
> ABORT          :R1      ABORT
> Break 1 [16]> :a
> [17]> (ascii-code-p 65 16)
> 10
> [18]> (ascii-code-p 49)
> 1
> [19]> (ascii-code-p 32)
> NIL
> [20]>
>                                                                 
> 
> You may want to use:
> 
> (defun char-ascii (ch)
>   (check-type ch character "CHAR-ASCII expects a character")
>   (cond ((eql ch #\Newline)  10)
>         ((eql ch #.(ignore-errors (read-from-string "#\\Rubout")))   127)
>         ((eql ch #.(ignore-errors (read-from-string "#\\Page")))      12)
>         ((eql ch #.(ignore-errors (read-from-string "#\\Tab")))        9)
>         ((eql ch #.(ignore-errors (read-from-string "#\\Backspace")))  8)
>         ((eql ch #.(ignore-errors (read-from-string "#\\Return")))    13)
>         ((eql ch #.(ignore-errors (read-from-string "#\\Linefeed")))  10)
>         ((+ 32 (position ch " !\"#$%&'()*+,-./0123456789:;<=>?
>     @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijk
>        lmnopqrstuvwxyz{|}~" :test (function char=))))
>         (t (error "Character ~C has no ASCII code" ch))))
> 
> to be able to call: 
> 
> (list (ignore-errors (ascii-code-p (char-ascii #\4)))
>       (ignore-errors (ascii-code-p (char-ascii #\?))))
> --> (4 NIL)
> 
> 
> 
> But note that #+clisp (digit-char-p #\?) --> 4
> so perhaps the constraint on ASCII is not what you want?

Interesting.  (digit-char-p #\?) evaluates to NIL for me (OpenMCL,
AquaEmacs, Slime)

Pascal, thanks for helping.
From: Pascal Bourguignon
Subject: Re: Where To Begin
Date: 
Message-ID: <87fymcv0b2.fsf@thalassa.informatimago.com>
····@stablecross.com (Bob Felts) writes:

> Pascal Bourguignon <······@informatimago.com> wrote:
>
>> ···············@hotmail.com" <············@gmail.com> writes:
>> 
>> > ········@gmail.com wrote:
>> >> Bob ha escribo
>> >> >for example, just today, I had to ask about how to comment about blocks
>> >> >of Lisp code; and surely there is a better way to convert from an ASCII
>> >> >digit to a number than (- (char-int c) (char-int #\0)).
>> >>
>> >> READ-FROM-STRING (with *read-eval* @ nil)
>> >
>> > NO. #'digit-char-p  (digit-char-p char &optional radix) => weight
>> 
>> But this doesn't do the same thing.  
>> DIGIT-CHAR-P converts a character to a decimal digit weight.
>
> DIGIT-CHAR-P seems to do exactly what I wanted... #\0 -> 0,
> #\1 -> 1, #\9 -> 9, #\- -> nil
>
>> 
>> Bob wanted to convert an ASCII code to a number. 

All right, I should I written: "Bob told us he wanted ..."

> [...]
> But this only works if code is of integer type.  

Of course, ASCII defines a mapping between integers in the range
0..127 and characters.  In lisp, characters are first class objects,
they stand for themselves.  CHAR-CODE doesn't return the ASCII code
(it couldn't, most characters don't have any ASCII code),
it returns A code, whatever code used by the current lisp implementation.


> My input data is
> standard-char.  It was getting standard-char to be it corresponding
> integer that was the original problem.  (- (char-int c) (char-int #\0))
> was my original solution.

Then you lied us!  You didn't want to convert ASCII digits, you wanted
to convert characters.  Liar!  :-)



>> But note that #+clisp (digit-char-p #\?) --> 4
>> so perhaps the constraint on ASCII is not what you want?
>
> Interesting.  (digit-char-p #\?) evaluates to NIL for me (OpenMCL,
> AquaEmacs, Slime)

Yes, the specification of DIGIT-CHAR-P is not too precise for
characters that are not BASE-CHARACTER.  So this is implementation
dependant.  clisp likes unicode and returns a meaningful value for
unicode characters representing digits.  But at the same time, 

#+clisp (let ((strange-imho  "4")) ; #\fullwidth_digit_4
          (values (type-of (read-from-string strange-imho))
                  (digit-char-p (character strange-imho))))
--> symbol ;
    4 

since the specified reader algorithm doesn't allow reading non
BASE-CHARACTER digits as numbers (and there are edge cases that would
be hard to interpret, like mixing digits from different scripts).

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
Our enemies are innovative and resourceful, and so are we. They never
stop thinking about new ways to harm our country and our people, and
neither do we. -- Georges W. Bush
From: ··············@hotmail.com
Subject: Re: Where To Begin
Date: 
Message-ID: <1140574817.955593.122590@g47g2000cwa.googlegroups.com>
Pascal Bourguignon wrote:

> Yes, the specification of DIGIT-CHAR-P is not too precise for
> characters that are not BASE-CHARACTER.  So this is implementation
> dependant.  clisp likes unicode and returns a meaningful value for
> unicode characters representing digits.  But at the same time,
>
> #+clisp (let ((strange-imho  "4")) ; #\fullwidth_digit_4
>           (values (type-of (read-from-string strange-imho))
>                   (digit-char-p (character strange-imho))))
> --> symbol ;
>     4
>
> since the specified reader algorithm doesn't allow reading non
> BASE-CHARACTER digits as numbers (and there are edge cases that would
> be hard to interpret, like mixing digits from different scripts).

Yes, we've been here before :-)

<··············@thalassa.informatimago.com> and following.
From: fireblade
Subject: Re: Where To Begin
Date: 
Message-ID: <1140525503.128891.227000@g43g2000cwa.googlegroups.com>
Touretzky is definately place to start  for anybody except really good
programmers in other language, then go with PCL , Onlisp  all of them
are free.
Common Lisp the language 2, Hyperscpec and allegro documentation are
great for reference.

After you finish  Touretzky choose some project that interests you and
work on it , learning by doing is the best way.

bobi
From: Tin Gherdanarra
Subject: Re: Where To Begin
Date: 
Message-ID: <463lg3F9745nU1@individual.net>
············@gmail.com wrote:
> I've recently become interesting in trying to learn a bit about Lisp.
> 
> For the mean time, I'd like to go into things without purchasing
> anything. I'm working through Peter Seibel's tutorial at
> www.gigamonkeys.com using SLIME and Allegro; however, I feel as though
> another introductory level publication and a reference source would be
> useful.
> 
> Does anyone have a reccomendation for introductory tutorials or
> references?
> 
> Thank you
> 
> -Joe
> 

More reputable Lispniks might have other opinions, but
here is mine: The best introductory book is

"A gentle introduction to symbolic computation" by
  David S. Touretzky. It is available online for free:

http://www.cs.cmu.edu/~dst/LispBook/

The book is not as geek-oriented as Peter Seibel's
book and does not deal with macros in depth. But:
It is very thorough on basic issues, like
"what is a list", debugging, important global
variables and the like. And it's not named "gentle"
for nothing. It is carefully worded and makes a
light read despite its sophisticated matters.
The gentle introduction is full of toy examples,
but most of them are rewarding and sort of cute.
The biggest danger is to start skipping pages
because alert readers always find pages stating
things fairly obvious, but then you might miss
important surprises that are not obvious at all.

Peter Seibel's "Practical Common Lisp" is very good
for beginners, too, but it has a faster pace and
different priorities. I would read it after the gentle
introduction in order to get a feel for how to
tackle real-world problems with Lisp. If you are
21st century slashdot-bred web-sort of dude, you
will feel more comfortable with Peter Seibel's book
than with Touretzky's which is from the eighties
and addresses a college audience, not perl- or
java-hardened folks having grown up with 32bit
Uberpentiums. Nevertheless, I think Touretzky is
easier to understand. Since both books are available
online, try both.