From: Lars Rune Nøstdal
Subject: Re: What is Lisp used for?
Date: 
Message-ID: <1224521818.7962.89.camel@blackbox>
On Mon, 2008-10-20 at 06:36 -0700, cartercc wrote:
>  Is Java really that much more useful than Lisp?

Yes, Britney Spears vs. ..hmm.. The Dave Brubeck Quartet?


"What's so great about Lisp? And if Lisp is so great, why doesn't
everyone use it?" ..see: http://www.paulgraham.com/avg.html


"If you have to ask what jazz is, you'll never know."
  --Louis Armstrong


Also see fashion vs. DNA (try Wikipedia) and
  http://wiki.alu.org/The_Road_to_Lisp_Survey


I'm using Lisp for:

  * Browser based UIs (AJAX/Comet blah...)
  * Talking with PostgreSQL (the Postmodern library)


Here is some source code from a mail/user/domain-admin interface:

        (defwidget domain-list-entry (html-container)
          ((domain :reader domain-of :initarg :domain
                   :initform (error ":DOMAIN needed."))
           (edit-btn :initform (mk-button "Edit"
                                          :margin-right 10
                                          :on-click
                                          (mk-cb (edit-btn)
                                            (declare (ignore edit-btn))
                                            (replace self
                                                     (make-instance 'edit-domain-dialog
                                                                    :domain (domain-of self)
                                                                    :margin-top 20 :margin-bottom 20
                                                                    :on-remove-fn
                                                                    (mk-on-remove-fn (edit-domain-dialog cnt :once-only-p t)
                                                                      (declare (ignore cnt))
                                                                      (replace edit-domain-dialog
                                                                               self)))))))))
        
        
        (defmethod generate-html ((domain-list-entry domain-list-entry))
          (with-slots (domain edit-btn) domain-list-entry
            (who
             (:sw edit-btn)
             (str (name-of domain)))))
        
        
        
        (defwidget domain-list (html-container)
          ((domain-cnt :reader domain-cnt-of
                       :initform (mk-container nil))))
        
        
        (defmethod initialize-instance :after ((domain-list domain-list) &key)
          (dolist (domain (get-domains))
            (add (make-instance 'domain-list-entry :domain domain)
                 (domain-cnt-of domain-list))))
        
        
        (defmethod generate-html ((domain-list domain-list))
          (who
           (:sw (domain-cnt-of domain-list))))



When the save-button is clicked in edit-domain-dialog, REMOVE is simply
called on the dialog itself which will trigger the ON-REMOVE-FN callback
in the code above:

        (defmethod save ((edit-domain-dialog edit-domain-dialog))
          (with-slots (domain domain-ti max-num-users-ti max-num-aliases-ti) edit-domain-dialog
            (setf (name-of domain) (value-of domain-ti)
                  (max-num-users-of domain) (parse-integer (value-of max-num-users-ti))
                  (max-num-aliases-of domain) (parse-integer (value-of max-num-aliases-ti)))
            (update-db domain)
            (remove edit-domain-dialog)))



PS: You have not been "trying to learn Lisp for several years". Don't
lie.

-- 
Lars Rune Nøstdal   || AJAX/Comet GUI type stuff for Common Lisp
http://nostdal.org/ || http://groups.google.com/group/symbolicweb

From: cartercc
Subject: Re: What is Lisp used for?
Date: 
Message-ID: <d30783f3-ee15-4eb9-8b39-ba4c74620e13@h2g2000hsg.googlegroups.com>
On Oct 20, 12:56 pm, Lars Rune Nøstdal <···········@gmail.com> wrote:
> I'm using Lisp for:
>
>   * Browser based UIs (AJAX/Comet blah...)
>   * Talking with PostgreSQL (the Postmodern library)

Thanks much. A straight answer to an honest question. And thanks for
the code.

> PS: You have not been "trying to learn Lisp for several years". Don't
> lie.

I quess that depends on your conception of 'trying.' See my answer to
Kenny's post. To date, I have purchased Graham, Wilensky. Seibel,
Lamkins, and Friedman, and have 'read through' all of them will little
to show for it except for Wilensky. Give me some credit for sticking
with it.

"If at first you don't succeed, quit."

-- er -- did I get it right? Maybe I should have quit after making a
hash of the first Lisp book. After all, had I really tried, I would be
a certified Lisper by now. Right?

CC
From: Tamas K Papp
Subject: Re: What is Lisp used for?
Date: 
Message-ID: <6m4itfFf2mcvU1@mid.individual.net>
On Mon, 20 Oct 2008 15:49:39 -0700, cartercc wrote:

> I quess that depends on your conception of 'trying.' See my answer to
> Kenny's post. To date, I have purchased Graham, Wilensky. Seibel,
> Lamkins, and Friedman, and have 'read through' all of them will little
> to show for it except for Wilensky. Give me some credit for sticking
> with it.

None of those books are for "reading through".  You should try out what 
you have learned by writing simple programs or at least a few functions 
after each section or chapter, otherwise it is not going to sink in and 
you will get lost by page 80 or sooner.  Same as math, math books are not 
read but followed with pencil and paper.

Tamas
From: cartercc
Subject: Re: What is Lisp used for?
Date: 
Message-ID: <c09859f1-0025-4745-b5df-ce621552f291@g61g2000hsf.googlegroups.com>
On Oct 20, 7:35 pm, Tamas K Papp <······@gmail.com> wrote:

> None of those books are for "reading through".  You should try out what
> you have learned by writing simple programs or at least a few functions
> after each section or chapter, otherwise it is not going to sink in and
> you will get lost by page 80 or sooner.  

Due to my circumstances, this was not possible at the time. I was
either at work or at school, so I kept the book (Graham) with me and
read it standing in line, waiting for red lights, or at night in bed.
I didn't touch a keyboard until I started reading PCL, and while PCL
has plenty of practical chapters, it didn't have the end of chapter
exercises designed to have you think through bits and pieces of the
language to build on.

You are 100% correct about 'reading through' a language book. Without
the fingers it's pretty much useless.

CC
From: Lars Rune Nøstdal
Subject: Re: What is Lisp used for?
Date: 
Message-ID: <1224545236.7962.166.camel@blackbox>
On Mon, 2008-10-20 at 15:49 -0700, cartercc wrote:
> On Oct 20, 12:56 pm, Lars Rune Nøstdal <···········@gmail.com> wrote:
> > I'm using Lisp for:
> >
> >   * Browser based UIs (AJAX/Comet blah...)
> >   * Talking with PostgreSQL (the Postmodern library)
> 
> Thanks much. A straight answer to an honest question. And thanks for
> the code.
> 
> > PS: You have not been "trying to learn Lisp for several years". Don't
> > lie.
> 
> I quess that depends on your conception of 'trying.' See my answer to
> Kenny's post. To date, I have purchased Graham, Wilensky. Seibel,
> Lamkins, and Friedman, and have 'read through' all of them will little
> to show for it except for Wilensky. Give me some credit for sticking
> with it.
> 
> "If at first you don't succeed, quit."
> 
> -- er -- did I get it right? Maybe I should have quit after making a
> hash of the first Lisp book. After all, had I really tried, I would be
> a certified Lisper by now. Right?
> 
> CC

..hehe, yeah:

  "Kids, you tried your best and you failed miserably. The lesson is,
   never try."
    -- Homer Simpson.

:}

Either go in with 100% effort, guns blazing and get rid of all
distractions and interrupts (like these) - or don't bother; it'll take
forever otherwise.

Don't think of it in terms of replacing Java. Instead, think of it as
learning something entirely new from scratch; you'll do much better.

..the younger you are the easier and less painful this is by the way, so
hurry. ;)

-- 
Lars Rune Nøstdal   || AJAX/Comet GUI type stuff for Common Lisp
http://nostdal.org/ || http://groups.google.com/group/symbolicweb
From: cartercc
Subject: Re: What is Lisp used for?
Date: 
Message-ID: <4e01471e-db8b-439c-b060-7cb2cf53bec3@k7g2000hsd.googlegroups.com>
On Oct 20, 7:27 pm, Lars Rune Nøstdal <···········@gmail.com> wrote:
> ..the younger you are the easier and less painful this is by the way, so
> hurry. ;)

I'm 58, and I'm finding that picking up new skills is getting
noticeably harder.

CC
From: ······@gmail.com
Subject: Re: What is Lisp used for?
Date: 
Message-ID: <1c4ea4c6-db27-4b3e-a899-1a526cef9645@f37g2000pri.googlegroups.com>
On Oct 21, 5:49 am, cartercc <········@gmail.com> wrote:
> On Oct 20, 7:27 pm, Lars Rune Nøstdal <···········@gmail.com> wrote:
>
> > ..the younger you are the easier and less painful this is by the way, so
> > hurry. ;)
>
> I'm 58, and I'm finding that picking up new skills is getting
> noticeably harder.

Welcome to comp.lang.lisp! We are all retired, semi-retired, jobless,
legally handicapped, or otherwise wanderers that has little relevance
to the real world.

Kenny, say something humorous please.

  Xah
∑ http://xahlee.org/

☄
From: Kenny
Subject: Re: What is Lisp used for?
Date: 
Message-ID: <48fe5588$0$4891$607ed4bc@cv.net>
······@gmail.com wrote:
> On Oct 21, 5:49 am, cartercc <········@gmail.com> wrote:
> 
>>On Oct 20, 7:27 pm, Lars Rune Nøstdal <···········@gmail.com> wrote:
>>
>>
>>>..the younger you are the easier and less painful this is by the way, so
>>>hurry. ;)
>>
>>I'm 58, and I'm finding that picking up new skills is getting
>>noticeably harder.
> 
> 
> Welcome to comp.lang.lisp! We are all retired, semi-retired, jobless,
> legally handicapped, or otherwise wanderers that has little relevance
> to the real world.
> 
> Kenny, say something humorous please.

Sorry, I am only fifty-seven, I cannot relate to these older guys.

hth,kzo
From: Grant Rettke
Subject: Re: What is Lisp used for?
Date: 
Message-ID: <d288863a-5d70-4c1c-81c7-8b7511a55846@8g2000hse.googlegroups.com>
On Oct 20, 6:27 pm, Lars Rune Nøstdal <···········@gmail.com> wrote:
> Either go in with 100% effort, guns blazing and get rid of all
> distractions and interrupts (like these) - or don't bother; it'll take
> forever otherwise.

That is a good advice. You really need to take the "deep dive" if you
want to get a sense of why people love it so much.

Such discipline really isn't the norm today, though, for students or
professionals.
From: Slobodan Blazeski
Subject: Re: What is Lisp used for?
Date: 
Message-ID: <105e1e69-2017-4f8b-a183-bebf24e2900d@2g2000hsn.googlegroups.com>
On Oct 21, 12:49 am, cartercc <········@gmail.com> wrote:
> On Oct 20, 12:56 pm, Lars Rune Nøstdal <···········@gmail.com> wrote:
>
> > I'm using Lisp for:
>
> >   * Browser based UIs (AJAX/Comet blah...)
> >   * Talking with PostgreSQL (the Postmodern library)
>
> Thanks much. A straight answer to an honest question. And thanks for
> the code.
Previously I've used lisp for writing web staff with hunchentoot and
later with weblocks http://common-lisp.net/project/cl-weblocks/
Now I'm using lisp to write write implementation  of my language edi.
And I should started earlier with lisp instead of c/c++ that got me
nowhere.
Now I'm working on a god damn CPS conversion. Some code below:
>
> > PS: You have not been "trying to learn Lisp for several years". Don't
> > lie.
>
> I quess that depends on your conception of 'trying.' See my answer to
> Kenny's post. To date, I have purchased Graham, Wilensky. Seibel,
> Lamkins, and Friedman, and have 'read through' all of them will little
> to show for it except for Wilensky. Give me some credit for sticking
> with it.
>
> "If at first you don't succeed, quit."
Well maybe lisp isn't for you. I have a certain rule for learning new
technology, if I don't feel it natural after a month dump it.
Different people have different favourite language
>
> -- er -- did I get it right? Maybe I should have quit after making a
> hash of the first Lisp book. After all, had I really tried, I would be
> a certified Lisper by now. Right?
>
> CC

;;; Utilities
(defvar *counter* 1)
(defun genvar () (read-from-string (string+ "r" (incf *counter*))))
(defun string+ (&rest args)
   (apply #'concatenate 'string  (mapcar #'princ-to-string args)))
(defun primitive? (e) (member (car e) '(+ - * / abs)))
(defun conditional? (e) (equal (car e) 'if))
(defun primitivize (x) (read-from-string (string+ "_" x)))
(defun listify (&rest args)
  (reduce #'append (mapcar #'(lambda (x) (if (listp x) x (list x)))
args)))

(defun define? (e) (equal 'define (car e)))

(defun prim-convert (p r k)
  (cond ((null p) (listify r k))
        ((atom (car p))
         (prim-convert (cdr p) (listify r (car p)) k))
        (t
         (let ((r1 (genvar)))
          (prim-convert (cdr p) ())))))

(defun with-r (l)
  (mapcar #'(lambda (x) (if (atom x) x (genvar))) l))

(defun create-asr (rs e)
  (cond ((null e) nil)
        ((atom (car e))
         (create-asr (cdr rs) (cdr e)))
        (t (cons (list (car rs) (car e))
                 (create-asr (cdr rs) (cdr e))))))
(defun cps-primitive (e k)
  (let* ((rs (with-r (cdr e)))
         (asr (create-asr rs (cdr e))))
   (if asr
     (cps-primitive-x asr (listify (car e) rs k))
     (listify (listify (car e) rs k)))))

(defun cps-primitive-x (asr k)
 (cond ((null asr) k)
       ((every #'atom (cadar asr))
        (listify (cadar asr)
          (list `(lambda (,(caar asr))
                  ,(cps-primitive-x (cdr asr) k)))))
       (t (cps-primitive (cadar asr)
           (list `(lambda (,(caar asr))
                    ,(cps-primitive-x (cdr asr) k)))))))

(defun cps-if (e k)
  (let ((r (genvar)))
   (cps (cadr e)
       (list `(lambda (,r)
                (if ,r ,(cps (third e) k) ,(cps (fourth e) k)))))))

(defun cps (e k)
  (cond ((atom e) (list k e))
        ((define? e)
         (list 'define (second e) (listify (third e) k)
               (cps (fourth e) k)))
        ((primitive? e)
         (cps-primitive e k))
        ((conditional? e)
         (cps-if e k))))
From: cartercc
Subject: Re: What is Lisp used for?
Date: 
Message-ID: <3f2ac282-80e0-4963-86c9-1a374e9a3b04@s50g2000hsb.googlegroups.com>
On Oct 21, 6:23 am, Slobodan Blazeski <·················@gmail.com>
wrote:

> Well maybe lisp isn't for you. I have a certain rule for learning new
> technology, if I don't feel it natural after a month dump it.
> Different people have different favourite language

Thanks much. Maybe Lisp isn't for me. I was productive in C, Perl, and
Python after two weeks. I have a friend who has been 'learning' Perl
for a couple of years, and he still confuses arrays and hashes.

CC
From: Slobodan Blazeski
Subject: Re: What is Lisp used for?
Date: 
Message-ID: <ee3f6264-19b5-474e-a764-73876143f954@y21g2000hsf.googlegroups.com>
On Oct 21, 2:59 pm, cartercc <········@gmail.com> wrote:
> On Oct 21, 6:23 am, Slobodan Blazeski <·················@gmail.com>
> wrote:
>
> > Well maybe lisp isn't for you. I have a certain rule for learning new
> > technology, if I don't feel it natural after a month dump it.
> > Different people have different favourite language
>
> Thanks much. Maybe Lisp isn't for me. I was productive in C, Perl, and
> Python after two weeks.
I think we misunderstand each other.I'm not talking about being
productive but about being natural.
Being productive is easy when you're learning language that is similar
to whatever you know already.
If you know c it easier to become productive in c++, hell just forgot
the OOP. If you know c++ it's easy to become productive in c#/java.
I never tried Perl but languages like c/c++/c#/java, basic, pascal,
python,ruby are very similar to each other. Lisp is different, Prolog
is different, APL is different, Haskell is different, factor is
different. If you're going from mainstream languages you already know
it's normal to be unproductive in those that want paradigm shift like
before mentioned.
Don't judge by being productive, take this great free book
http://www.cs.cmu.edu/~dst/LispBook/index.html and after 3 weeks you
still feel lisp style unnatural, look elsewhere. Because you're either
not ready or not a lisp person.

bobi
P.S.
Below are two links that describe my frustration with Haskell and
finding out that I'm not a haskell person, or maybe I'm not ready to
work with type system.
http://tourdelisp.blogspot.com/2008/03/lisper-first-look-at-haskell.html
http://tourdelisp.blogspot.com/2008/03/farewell-haskell.html