Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

(OT) Has anyone gone from perl to lisp?

by leocharre (Priest)
on Jul 17, 2008 at 17:48 UTC ( [id://698392]=perlmeditation: print w/replies, xml ) Need Help??

Has anyone gone from perl to lisp? I don't mean dabbed in these- but really uses both or went to lisp.

Did you really leave vi for emacs?

Could you compare the perl and lisp learning curves?

I toy off and on with the idea of going beyond bash and perl- Lisp seems interesting.

Replies are listed 'Best First'.
Re: (OT) Has anyone gone from perl to lisp?
by Joost (Canon) on Jul 17, 2008 at 19:11 UTC
    I'm have used and am still using perl a lot. I'm working on improving my lisp experience - nothing really serious yet, compared to the perl work.

    Lisp *is* very interesting. If you're curious, you could do a lot worse than to get the practical common lisp book (links to the freely available web version).

    IMO, lisp doesn't have a high learning curve, especially not if you already know about things like symbols, closures, hash tables, packages etc. It looks different, but you really get used to the parentheses quickly and the language is pretty consistent.

    I left vi for emacs a couple of years ago. it was worth the learning curve. And despite some people not liking it, Emacs (with Slime) is really the best (free) development environment, for lisp at least.

Re: (OT) Has anyone gone from perl to lisp?
by BrowserUk (Patriarch) on Jul 18, 2008 at 18:53 UTC

    I first encountered Lisp on a short programming course I took many years ago, long before I used either C or Perl. I passed the course, but failed to be enthused by the language. I've paid several re-visits to the environs of Lisp-world over the years, and indeed, I'm going through another right now as it is the language used in a book I'm reading.

    I feel about Lisp, much the way I feel about ballet.

    I can admire the elegance of the forms; the way a few basic steps can be combined into an infinite variety of ways. I can also admire the technical skills and dedication of the practitioners.

    But when it comes to viewing an entire production, so much of the detail of the individual steps, and the individual performances, becomes lost in the overall spectacle of the story and production, that the technical skills become obscured in all the random running and jumping about.

    And likewise, the details of the individual steps and individual performances, detracts from my ability to discern and follow the overall plot and story.

    And so it is (for me), with even medium-sized Lisp productions.

    The very simplicity and consistency of the basic construction: (op arg arg arg)-- the very thing that underlies Lisp's elegance, the very thing that makes it so simple for the computer to parse and translate efficiently-- becomes the barrier to the human being's ability (*this* human being's ability), to grasp the structure and flow of the overall production.

    It's not, as is so often cited, not least by me, the profusion of parenthesis that is the biggest problem, though it certainly does not help. It is much more the lack of the visual and structural clues to the organisation and flow of the code that one gets from block structured languages. The familiar keywords: if, elsif, else, for, while, until etc. that allow the brain to pick out clues to the structure and layout of a piece of code. And "pretty print" style layout does little to help.

    This problem is exacerbated by the prefix-only notation. Even the least mathematical amongst us are still very familiar with 'normal' algebraic 'infix' notation, and despite the extensibility of prefix notation to multi-parameter forms, the lack of familiarity for the common 1 or 2 parameter forms detracts from readability.

    A comparison

    Take for instance encountering this (anonymised) Lisp function(*) for the first time:

    (defun f (a b c) (let ((t (sqrt (- (* b b) (* 4 a c)))) (values (/ (+ (- b) t)) (* 2 a))) (/ (- (- b) t) (* 2 a))))

    Even with the presence of various instantly recognisable motifs, working out what it is intended to do is quite difficult when compared to an equivalent Perl definition:

    sub f { my( $a, $b, $c ) = @_; my $t = sqrt( $b**2 - 4*$a*$c ); return( ( -$b - $t ) / 2*$a, ( -$b + $t ) / 2*$a ); }

    (*)I'm aware that there are better alternate implementations

    Some people will be thinking to themselves that if the functions were given proper names then this problem would disappear. But, this particular function executes a formula that is instantly recognisable to anyone who has done a little mathematics. Most function definitions you will encounter in programs will be very specific to the domain of the program, and so far less recognisable.

    Is the implementation correct?

    Besides which, there is the secondary problem of deciding whether the implementation of the formula is correct.

    How many of the Lisp-familiar readers picked out that the lisp definition above has a deliberate error?

    An analogy

    For an instructive exercise that demonstrates the difference very vividly, go to google earth or MSN Virtual Earth and find a satellite image of a piece of countryside you are familiar with. Then look at the same thing with an overlay of the major roads and town names. Pretty much all the same information is there in both representations, but the blandness and sameness and lack of key-points and highlighting in the bare image, make it much harder to discern the detail. Much harder to orient oneself to the layout.

    And once you have located a particular point of interest, when you go off looking for the next, it's very easy to lose track of the initial point when you need to divide your attention between the two. The lack of reference points seriously detracts from the visual parsability of the code.

    Vocabularies

    With C and Perl (and the many other block structured languages), the basic structure of program is clearly delineated by the familiar --even across languages--keywords and structural elements. but it goes much further. There are also the 'built-in' functions, which in the case of C, the standard C library serves the same purpose.

    Despite the richness of these function-sets, they form a contained vocabulary of words that one pretty rapidly becomes familiar with, that serve to enhance the immediacy of ones understanding of unfamiliar pieces of code.

    With languages, like Lisp and Haskell, where one defines your own DSL to solve each individual problem and subproblem space, each organisation and even programmer, develops their own libraries of DSLs, and choses their own names--and more importantly, their own naming conventions--for them. And these start at the lowest levels, so the process of becoming familiar with any given piece of high-level code requires you to start much lower in the chain in order to develop your understanding. And worse, whatever familiarity one achieves with the building block levels at one organisation are usually not transferable to others.

    Standardised libraries like Haskell's Prelude go some way to mitigating this problem. But then, in the process of constructing those libraries, they are in effect reconstructing Perl's built-in vocabulary, and in part, throwing away some of the purpose of the minimal language definition in the process.

    (My) Conclusion

    The Lisp family of languages are tuned for their parsability by interpreters and compilers, not human beings. And being a human being, I prefer the extra structural reference points that the block structured syntax of C, Perl and similar give me. Both from the point of constructing code, and more so, when trying to understand pre-existing code. Especially code that I did not write.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re: (OT) Has anyone gone from perl to lisp?
by shmem (Chancellor) on Jul 17, 2008 at 22:25 UTC

    I'm pretty sure somebody coined the phrase "perl is just lisp with lots of syntactic sugar" or something like that; the memory is in here, connected somehow to... to... uh. If it wasn't, I coin that phrase here to throw it in as a bait ;-)

    I've done some lisp, time ago, but I've found it - while interesting - less practical than perl, and I need to get my jobs done, which mostly involve makeshifts and cranking out solutions quickly for pressing problems. Nothing better than perl and CPAN for that.

    I'm on and off teaching myself haskell, erlang, ocaml, Standard ML, but practical demands always pull me away from them, and so I find myself again patching C code, writing perl, extending shell scripts. There are many languages that are interestingly different to perl which I really would like to not only know, but master... if I could come up with a business case... my favorite among these is FORTH, which I might study zen-like after retirement; for now occasional PostScript hacking has to do.

    In short, the urgent doesn't leave time for the important.

    I'm glad my job doesn't force me to PHP, but python is creeping slowly onto my desk to bore me. :-(

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
Re: (OT) Has anyone gone from perl to lisp?
by moritz (Cardinal) on Jul 17, 2008 at 18:48 UTC
    I've tried to go to lisp, and failed. Later I tried to learn haskell (to contribute to pugs), and failed again. Either it was the different model of thinking that I don't really grok, or it's my impatience. When I learn a language, I code a few small things, but if I fail to see how to do more complex stuff, I quickly fall back to perl.

    I'm now trying to learn Perl 6, which is, among other things, lisp with non-lispy syntax ;-). I hope that the different syntax cheats my brain enough so that I'll succeed this time.

Re: (OT) Has anyone gone from perl to lisp?
by vrk (Chaplain) on Jul 18, 2008 at 08:58 UTC

    I spent quite some time programming in Scheme and Haskell a year or two ago. Both are very nice programming languages, but I always slide back to Perl. It's difficult to ascertain why, but some reasons include:

    1. Perl is everywhere. Scheme or Lisp compilers and interpreters are not, and they are sometimes harder to install. Same goes with Haskell. This isn't a chicken and egg problem for Lisp anymore; it's been around for 50 years.
    2. Perl integrates. CPAN. No such thing for Lisp or Haskell yet, which makes it awkward to be lazy. (Or: you spend more time re-inventing the wheel and steam engine.)
    3. Perl is good enough. The only things I'm missing from Scheme and Haskell are macros, less convoluted syntax, and static types -- all of which can be found in Perl 6.

    However, I heartily recommend both programming languages. It gives you more perspective and problem-solving strategies even if you never switch permanently over.

    --
    print "Just Another Perl Adept\n";

      Perl integrates. CPAN. No such thing for Lisp or Haskell yet, which makes it awkward to be lazy. (Or: you spend more time re-inventing the wheel and steam engine.)
      While it's broadly true that Lisp doesn't have as vast a centralized repository of extensions as CPAN (I have no experience with Haskell), asdf-install combined with cliki.net do provide a way to download, test and install many of the more interesting Common Lisp extensions.

      Note that Common Lisp is "just" a standard, with quite a lot of implementations and because of the age of the standard (work on the standards started in the 1986, but lisp was already old back then) it doesn't include many of the things that nowadays are taken for granted, like threads and network APIs (and other parts seem very complex, like the official file system API).

      All of this means that it's not always easy to make interesting extensions portable across implementations (though there's quite a lot of work going on to make it easier), which may explain why Lisp doesn't have as large a library of tools as Perl does.

Re: (OT) Has anyone gone from perl to lisp?
by MidLifeXis (Monsignor) on Jul 17, 2008 at 21:52 UTC

    A number of years ago, while in undergrad, I learned clisp for a college class. Then I used it for a semester writing a game engine for an algorithms class (testing the effects of a-b pruning, etc). Prior to that I started using emacs, but really started customizing it after my exposure to clisp. After that, I had yet another undergrad seminar course, AI, where it (well, scheme), was used extensively.

    All in all, recursion always came easily to me, and I think that is probably why I took to the lispy languages so easily. That doesn't mean that I could write anything extensive in them right now - it has been too long :)

    Oh, and I do use emacs extensively. Tramp and org-mode, font-lock and other features (*cough* tetris *cough*) make it powerful and consistent enough that I have only had to learn some of the power of vi. Of course, it helps with my choice that the platform we use here does not have VIM and some of the other tools available to it.

    emacs vs. vi is, however, a relegious issue, and not being more than sufficient in vi (as compared to proficient :), I will leave my choice as my choice only.

    Update: Knowing lisp also made map, foo($_) foreach @bar and other concepts of that type very easy to pick up.

    --MidLifeXis

Re: (OT) Has anyone gone from perl to lisp?
by hawtin (Prior) on Jul 18, 2008 at 11:47 UTC

    I did the exact reverse, Common Lisp/ Scheme (in the 1980s) => C/ Java (in the 1990s) => Perl (now). My reasons for using Perl these days are that:

    • Most of the code I write is for prototyping, to prove a point, it does not need to be fast or maintained by others and Perl (for me) is the quickest language to write (not the most efficient or most maintainable).
    • I work on Windows/ Linux and other systems and I need a language that just works everywhere.
    • CPAN: The structure of Perl just makes building reusable modules easy, the reason there is no CPAN for Lisp is because of the way the language works. CPAN is just so far ahead of anything similar it makes it possible to build stuff with Perl that would take forever with any other language.
    • Style: Perl can be written in whatever style makes it easy the address the problem. My scripts are a mix of procedural, functional, object and logic programming. This can make it hard to maintain someone else's code, but that's not usually an issue.

    And no, I never left Emacs. I used it on the Symbolics in the 1980s and I use it on my Windows machine today.

Re: (OT) Has anyone gone from perl to lisp?
by repellent (Priest) on Jul 18, 2008 at 00:27 UTC
    At my current job, I switch between coding in Perl, Cadence_SKILL, and ZSH.

    SKILL is a Lisp variant with the hacked-in option of specifying code in C-like syntax. So instead of
    (car my_list)
    we can also call it like
    car(my_list)
    In my opinion, probably the hardest thing about getting into a Lisp-like language is to change the way you think about solving problems. Akin to getting into Haskell, once you're tuned to a particular language, you will become very effective programming it.

    Initially going from C to Lisp is not as trivial as C to Perl (or a shell language). For instance, to be effective in Lisp, you have to get out of the "array-index" mode of thinking. Instead, you would be thinking about "list decorations" and working with powerful "list mapping" functionality. In Lisp, you would enjoy well-defined function returns that make programming higher-order macros and recursive algorithms a breeze. At the very least, it would expand the way you think about problems. Then, you can come back and apply what you've learned to Perl.

    My 2cents: Going from Bash/Perl to Lisp is a good idea.


    By the way, I have always kept with Vim. However, it would be well worth your time to dabble with Emacs as an experiment vehicle to learning Lisp.
Re: (OT) Has anyone gone from perl to lisp?
by dragonchild (Archbishop) on Jul 17, 2008 at 18:19 UTC
    Luke Palmer went from Perl 5 -> Perl 6 -> Haskell. I know a number of people who code heavily in both Perl and Javascript (myself included). I'm also teaching myself Erlang right now.

    Ovid wrote the Prolog module on CPAN, which is a similar braintwist.


    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
Re: (OT) Has anyone gone from perl to lisp?
by mpeg4codec (Pilgrim) on Jul 18, 2008 at 18:44 UTC
    I was taking AI and programming languages at the same time last spring at uni. About half of AI was devoted to Lisp, and we spent a lot of time on Scheme and other functional languages in PL.

    Absolutely 100% worth my time. I still dabble in those languages, but mostly took the excellent things I learned from them and applied them to Perl. It translated very well, and really gave me a new level of appreciation for Perl's TIMTOWTDI philosophy.

    The learning curve is a bit steeper for Lisp/Scheme, since you have to learn to think a little differently as repellent notes. But don't let it get you down. If you stick with it and have someone who legitimately loves the language help you, you'll have an ``A-ha!'' moment that feels really great.

    Again, I can't recommend it enough. I feel like learning to program functionally really helped me bridge a gap in my abilities, not just as a Perl programmer, but as a programmer in general.

Re: (OT) Has anyone gone from perl to lisp?
by hsmyers (Canon) on Jul 20, 2008 at 17:55 UTC
    I learned Lisp in the late 80's. First was muLisp. Later was pleasantly surprised when AutoCad used Betz's XLisp as their embedded language. After a decade or so I returned to Lisp as a mind exercise. I believe like Paul Graham that Lisp forces more attention to design up-front than most other languages which I take to be good exercise for all languages. Currently I'm using newLisp and having a blast. Haven't gotten around to Haskel yet, but I will. I've figured out that at least for me, a working knowledge and ability in Perl, Lisp, Python, Ruby and Haskel seems to be mandatory. When lisping, my sig is:
    "Censeo Toto nos in Kansa esse decisse."—D. Gale "ℑ♥λ"—Toto

    --hsm

    "Never try to teach a pig to sing...it wastes your time and it annoys the pig."
Re: (OT) Has anyone gone from perl to lisp?
by kalium (Sexton) on Jul 18, 2008 at 17:05 UTC
    I did a uni subject in Haskell, absolute mindfcuk for a 2nd year CS student who up until that point had only learnt C and Java. I also played with Lisp a little bit (little being the operative word). I think the paradigm shift is very hard (well it was for me anyway), and that mastering a functional language takes possibly a higher level of intelligence that I possess....
Re: (OT) Has anyone gone from perl to lisp?
by alexm (Chaplain) on Jul 20, 2008 at 20:42 UTC

    My first time with Lisp was also while studying AI. However, I didn't practise much since we were allowed to use any programming language for the exercises, so I used Perl ;-)

    Shortly after that course my AI teacher contacted me and joined Barcelona.pm because he was reading Learning Perl. Now he's more interested in Smalltalk, but he still feels that Perl is great and comes to our meetings.

Re: (OT) Has anyone gone from perl to lisp?
by vkon (Curate) on Aug 03, 2008 at 16:18 UTC
    I was interested in Lisp due to some AI systems (namely Maxima but there are more), and had an idea to use it with Perl together.

    It appears that Lisp do not play nice embedding games (except ECL, which is embeddable Lisp) but still embedding is possible.

    I've created Language::Lisp module on CPAN which currently stale (but is better on my local copy)
    may be I'll release better version sometimes soon...

Re: (OT) Has anyone gone from perl to lisp?
by Muggins (Pilgrim) on Jul 24, 2008 at 13:15 UTC

    When I looked at Lisp I liked the language. As with Perl, the people who like Lisp seem to *love* it.

    (Python people too, but I'm not sure about PHP)

    There were lots of versions of Lisp, which was a pain, and Emacs Lisp is different from Common Lisp (AND from ELisp). The Practical Common Lisp book is online - along with "Lisp in a box". Nice way to get into it.

    Pretty different from Perl, though you start to see where 1 or 2 Perl-ish things came from. Didn't persuade me to do everything in Lisp - the community was *nothing* like eg: Perlmonks, alas.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://698392]
Approved by Joost
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-03-29 04:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found