From: Todd Smith
Subject: lisp from perl
Date: 
Message-ID: <3656417B.6CFB2A93@viper.net>
is it easy to learn lisp if i'm pretty good at perl? do i even need to?

--
_______________
Todd Smith
Perl Programmer
ITC^Deltacom

From: Stig Hemmer
Subject: Re: lisp from perl
Date: 
Message-ID: <ekvk90p2azu.fsf@verden.pvv.ntnu.no>
Todd Smith <·······@viper.net> writes:
> is it easy to learn lisp if i'm pretty good at perl?

I'd say so, yes. 

Lisp is not a difficult language anyhow, but Perl will give you a
background to understand some of the things other people find
difficult.  Remember that almost everything in Lisp is what Perl would
call a reference.  If you know Perl references well, you are off to a
good start.  If you do not, I would recommend learning Lisp first,
then returning to Perl references afterwards.  (I believe that to be
the easier approach)

The main problem with learning any new language can be to put aside
what you already know.  I have no way of judging how hard that will be
for you.

>  do i even need to?

You must decide your needs for yourself.  However, I think you will
find that knowing Lisp will make you a better Perl programmer, if
nothing else.  And who knows, maybe you'll start a new career as a
Lisp programmer?

Stig Hemmer,                     
Jack of a Few Trades.            perl -e 'print "Not a Perl hacker.\n"'
From: rusty craine
Subject: Re: lisp from perl
Date: 
Message-ID: <73a60u$rk2$1@excalibur.flash.net>
Todd Smith wrote in message <·················@viper.net>...
>is it easy to learn lisp if i'm pretty good at perl? do i even need to?

Lisp is indeed easy to learn,  but if you want to became a "Leo Tolsty"  in
lisp, as any language, it may take a little more work then "easy to learn".
The all time best reason for learning lisp is that it makes you think.  The
most powerful tools in lisp (IMO) are recursion and abstraction.  Although
we have had a discussion on the need for a "powerful mind" to use powerful
lisp concepts, it is still my opinion that  the more abstract reasoning
ability you bring to lisp the more productive and powerful lisp is for you.
_AND_ on the flip side lisp does not ever limit your ability to put your
abstract reasoning ability to work.

The second best reason for learning lisp is that it is the best concept
proto-typer there is.    I can give you an example.  A oralfacilmaxillary
surgeon wanted  a proof of concept program for a software idea he was trying
to sell to a software vendor.  In a couple of afternoons we were able to get
his ideas into lisp.  The demostartion was a success and the program can be
purchased today (in c++ and VB).  Could it have been done any another
language, yep.  He had a contract programmer working in the same proof of
concept for over 30 days.  Sometimes simply powerful is better than
microsoft powerful.

rusty
>
>--
>_______________
>Todd Smith
>Perl Programmer
>ITC^Deltacom
>
>
From: Marco Antoniotti
Subject: Re: lisp from perl
Date: 
Message-ID: <lw67c8yo5w.fsf@copernico.parades.rm.cnr.it>
Todd Smith <·······@viper.net> writes:

> is it easy to learn lisp if i'm pretty good at perl? do i even need to?
> 

#define JOKING_MODE 1

Two things may be said.

1 If you learn (Common) Lisp well, you may start wondering why you
  learned Perl in the first place.

2 If you are good at Perl you may find Lisp very frustrating.

Finally, you should learn Lisp because it's better. Period.

#defin JOKING_MODE 0

Cheers

-- 
Marco Antoniotti ===========================================
PARADES, Via San Pantaleo 66, I-00186 Rome, ITALY
tel. +39 - (0)6 - 68 10 03 17, fax. +39 - (0)6 - 68 80 79 26
http://www.parades.rm.cnr.it
From: Bruce Tobin
Subject: Re: lisp from perl
Date: 
Message-ID: <36694B7A.F2997812@columbus.rr.com>
Todd Smith wrote:

> is it easy to learn lisp if i'm pretty good at perl?

Yes.

> do i even need to?

Depends what you want to do and what aspects of Perl you find irritating
while you're doing it.  Personally I find myself wishing I were using Lisp
instead of Perl whenever I'm manipulating collections whose members are
themselves collections.  In Perl you have to constantly keep
addressing/dereferencing issues in mind because Perl only handles
collections of scalar values.

For example, to print the elements of a list of lists one at a time in Perl
(example from Tom Christiansen's very useful Perl Data Structures
Cookbook):

    for $i ( 0 .. $#LoL ) {
        for $j ( 0 .. $#{$LoL[$i]} ) {
            print "elt $i $j is $LoL[$i][$j]\n";
        }
    }

in Lisp:

(dotimes (i (length LoL))
  (dotimes (j (length (elt LoL i)))
     (format
       "element ~A of list ~A is ~A"
        j i
        (elt (elt LoL i) j))
     ))

while $#{$LoL[$i]} may take less time to type than (length (elt LoL i)), I
find that, in my own case,
the latter takes less time to write.  Note that in Lisp you'd probably use
vectors rather than lists if you
were doing this sort of thing in this way; the code presented would look
exactly the same.
From: Rainer Joswig
Subject: Re: lisp from perl
Date: 
Message-ID: <joswig-0512981710170001@194.163.195.67>
In article <·················@columbus.rr.com>, Bruce Tobin
<······@columbus.rr.com> wrote:

> (dotimes (i (length LoL))
>   (dotimes (j (length (elt LoL i)))
>      (format
>        "element ~A of list ~A is ~A"
>         j i
>         (elt (elt LoL i) j))
>      ))
> 
> while $#{$LoL[$i]} may take less time to type than (length (elt LoL i)), I
> find that, in my own case,
> the latter takes less time to write.  Note that in Lisp you'd probably use
> vectors rather than lists if you
> were doing this sort of thing in this way; the code presented would look
> exactly the same.


(let ((LoL '((1 2 3) (a b c))))
  (loop for list in LoL
        for i from 0
        do (loop for item in list
                 for j from 0
                 do (format t "~%element ~A of list ~A is ~A" j i item))))

should be more efficient

-- 
http://www.lavielle.com/~joswig
From: Harvey J. Stein
Subject: Re: lisp from perl
Date: 
Message-ID: <m2u2z9ipw8.fsf@blinky.bfr.co.il>
Bruce Tobin <······@columbus.rr.com> writes:

 > For example, to print the elements of a list of lists one at a time
 > in Perl (example from Tom Christiansen's very useful Perl Data
 > Structures Cookbook):
 > 
 >     for $i ( 0 .. $#LoL ) {
 >         for $j ( 0 .. $#{$LoL[$i]} ) {
 >             print "elt $i $j is $LoL[$i][$j]\n";
 >         }
 >     }
 > 
 > in Lisp:
 > 
 > (dotimes (i (length LoL))
 >   (dotimes (j (length (elt LoL i)))
 >      (format
 >        "element ~A of list ~A is ~A"
 >         j i
 >         (elt (elt LoL i) j))
 >      ))

If all you want to do is print the elements (as you state in your
text), and aren't also interested in their locations in the lists (as
you write in your code), you should do something like:

(mapcar #'(lambda (inner-list)
                  (mapcar (lambda (el)
                                  (format t "~a\n" el))
                          inner-list))
        LoL)

-- 
Harvey J. Stein
BFM Financial Research
·······@bfr.co.il
From: Bruce Tobin
Subject: Re: lisp from perl
Date: 
Message-ID: <366B4F5E.842A6163@columbus.rr.com>
Harvey J. Stein [among others] wrote:

[ alternative code for printing elements of a list-of-lists ]

OK people, ease up.  My point was about the necessity of dereferencing
nonscalar members of collections in Perl; hence I wrote the Lisp to look
just like the Perl code except for this difference.  I realize this would
be inefficient, which was the point of my remark about vectors.  Actually
the remark should probably have been worded thus:

 "If you were doing this sort of thing in this way in Lisp, it would be
probably be because you were manipulating vectors rather than lists."
From: David Cooper
Subject: mapc vs. mapcar
Date: 
Message-ID: <366AB538.B1520E08@genworks.com>
Harvey J. Stein wrote:
> 
> If all you want to do is print the elements (as you state in your
> text), and aren't also interested in their locations in the lists (as
> you write in your code), you should do something like:
> 
> (mapcar #'(lambda (inner-list)
>                   (mapcar (lambda (el)
>                                   (format t "~a\n" el))
>                           inner-list))
>         LoL)
> 
> --
> Harvey J. Stein
> BFM Financial Research
> ·······@bfr.co.il

Note that if you just want to map through some lists and
do a side-effect (like printing), and don't care about
returning a new list, mapc is more efficient than mapcar
since it doesn't cons up a new list:

(defparameter outer-list '((a b c) (d e f) (g h i) (j k l)))

(mapc #'(lambda(inner-list)
	  (mapc #'(lambda(element)
		    (format t "~a" element))
		inner-list))
      outer-list)



 -djc
From: Espen Vestre
Subject: Re: lisp from perl
Date: 
Message-ID: <w6pv9w5or0.fsf@gromit.nextel.no>
·······@bfr.co.il (Harvey J. Stein) writes:

> If all you want to do is print the elements (as you state in your
> text), and aren't also interested in their locations in the lists (as
> you write in your code), you should do something like:
> 
> (mapcar #'(lambda (inner-list)
>                   (mapcar (lambda (el)
>                                   (format t "~a\n" el))
>                           inner-list))
>         LoL)

If all you want to do is to print the elements, you don't use mapcar,
you use mapc or dolist!

-- 

  espen
From: Erik Naggum
Subject: Re: lisp from perl
Date: 
Message-ID: <3122040885823268@naggum.no>
* Espen Vestre <··@nextel.no>
| If all you want to do is to print the elements, you don't use mapcar,
| you use mapc or dolist!

  I tend to use (map nil ...).

#:Erik
-- 
  The Microsoft Dating Program -- where do you want to crash tonight?