LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Python and Lisp (http://www.linuxquestions.org/questions/slackware-14/python-and-lisp-4175424016/)

Mercury305 08-25-2012 07:52 PM

Python and Lisp
 
This may appear OT in a Slackware forum. However I wanted to post this here to get some ideas from Slackware users. I have been studying a lot of computer science lately at home. Reading and what not in the last few weeks. I really am taking this seriously and quite focused. I seem to talk to very brilliant people on LQ and in this slackware forum so wanted some ideas. I was researching some programming languages and thought of starting out with Python at first but later grew quite attracted to Lisp as well. Anyone in here with experience of these languages and if it would be ok for me to start Lisp first before Python? I love the interaction between Computers and Humans in Lisp and am quite attracted to it. Especially from reading some things from Peter Norvig about it. I also noticed some great libraries for Slackware for Lisp as well. Anyways just wanted some feedback. Thanks

abrinister 08-25-2012 08:06 PM

Lisp is a pretty good beginner language. Python is too though. Both are scripting languages so they are much easier than, say, C. I'm going to learn Lisp when I go back to school in September in a Programming class. I've heard great things about it. There's a derivitive of Lisp called Racket. They also provide an IDE for it. There's a slackbuild for it here.

The Python interpreter comes with Slackware. The Python website provides a massive tutorial on the language. Here is Python 2.7 and 3.0.

Alex Brinister

dugan 08-25-2012 09:47 PM

Learning LISP first will make you a better Python programmer.

pixellany 08-25-2012 09:52 PM

Ummm.....nitpicker here....

I think of Python as an interpreted language---I think there's a subtle difference between that and "scripting". To me, the latter implies automating tasks in the native dialect of the shell. BASH, for example, with no real math capability, could hardly qualify as a real programming language. Python, OTOH, has all the bells and whistles.

pixellany 08-25-2012 09:53 PM

Quote:

Originally Posted by dugan (Post 4764336)
Learning LISP first will make you a better Python programmer.

What is your basis for that?

ttk 08-25-2012 10:38 PM

Quote:

Originally Posted by pixellany (Post 4764339)
What is your basis for that?

He's right. Python incorporates many syntactical features from LISP and other functional programming languages (like lambdas), and sometimes there's no better way to get it to perform decently than to use them.

For instance, these are both ways to do the same thing in Python (populate a list from passing the values in another list through a function).

example #1:
Code:

some_list = list()
for v in another_list:
    some_list.append(f(v))

example #2:
Code:

some_list = list(f(v) for v in another_list)
If you're like me and you learned C first, example #1 will seem more natural. Example #2 is considered more "pythonically correct", though, and runs a lot faster (about 50% faster on my hardware, using python 2.6.4). Learning LISP first will help make such syntax more intuitive to you.

Mark Pettit 08-26-2012 04:06 AM

Speaking as a Python freak, I have to say that once you learn and use Python, all other languages just lose their appeal. If this is your first language, then Python is definitely the way to go. However, LISP is a great language, and learning it will influence the way you think about programming. And it will improve any coding you do (unless you code in COBOL, in which case you're doomed). Look up 'Paul Graham' - he's a smart fellow with lots to say about LISP, Python, and other nice geekie stuff.

pixellany 08-26-2012 06:38 AM

Thanks for the enlightenment on commonality between LISP and Python. I have started to learn Python (----several times...;) ), but never looked at LISP.

Without knowing any better, perhaps i should have suggested that--if you want to learn Python--you should learn Python.

Mercury305 08-26-2012 08:15 AM

According to Peter Norvig Python is a dialect of Lisp and Lisp has many dialects. I am thinking Python may be a better language to learn 1st but quite attracted to Lisp as well.
PS If I wanted to learn a scripting language it would be shell scripting. But Python and Lisp is a whole lot more then that. and yes, it could be used for scripting as well which is very cool.

Mercury305 08-26-2012 08:23 AM

Quote:

Originally Posted by ttk (Post 4764355)
He's right. Python incorporates many syntactical features from LISP and other functional programming languages (like lambdas), and sometimes there's no better way to get it to perform decently than to use them.

For instance, these are both ways to do the same thing in Python (populate a list from passing the values in another list through a function).

example #1:
Code:

some_list = list()
for v in another_list:
    some_list.append(f(v))

example #2:
Code:

some_list = list(f(v) for v in another_list)
If you're like me and you learned C first, example #1 will seem more natural. Example #2 is considered more "pythonically correct", though, and runs a lot faster (about 50% faster on my hardware, using python 2.6.4). Learning LISP first will help make such syntax more intuitive to you.

Thanks I will be starting a biweekly course studying the MIT Book: Structure and Interpretations of Computer Programming (SICP)
with slashdot.org contributers. It uses Lisp in that book.
I will be around people that have contributed to Slackware too. I'm pretty excited. :D

Mercury305 08-26-2012 08:26 AM

Quote:

Originally Posted by dugan (Post 4764336)
Learning LISP first will make you a better Python programmer.

Thats great as I am starting with Lisp. Even though most people say learning python first is best that I listened to. But I agree with what you say.

Mercury305 08-26-2012 08:36 AM

Quote:

Originally Posted by Mark Pettit (Post 4764432)
Speaking as a Python freak, I have to say that once you learn and use Python, all other languages just lose their appeal. If this is your first language, then Python is definitely the way to go. However, LISP is a great language, and learning it will influence the way you think about programming. And it will improve any coding you do (unless you code in COBOL, in which case you're doomed). Look up 'Paul Graham' - he's a smart fellow with lots to say about LISP, Python, and other nice geekie stuff.

thanks ill take your advice

vharishankar 08-26-2012 10:41 AM

I love Python for it simplicity and elegance. Lack of curly braces and semicolons seem to be strange at first, but once you start coding in Python you won't miss them. In fact, the extra typing required for curly braces and semicolons will irritate you.

Very practical programming language for a wide variety of uses (except low-level systems programming of course).

qweasd 08-26-2012 11:22 AM

LISP (along with C, if anyone cares) is my favorite programming language. It makes me sound clever. If you'd like to learn Common Lisp in particular--my favorite dialect--here's a nice book I found most useful as a tutorial.

I don't know whether it matters that much which language is your first. I wish I learned LISP or C or some kind of Assembly first, but instead (iirc) it was MSX BASIC (which is a language AND an OS) on one of these. I feel like I obtained most of my skill while studying C and LISP, but I never felt handicapped by BASIC. It was fun :D

dugan 08-26-2012 01:13 PM

Quote:

Originally Posted by pixellany (Post 4764339)
What is your basis for that?

The functional programming techniques that you master with LISP are very much applicable to Python (and to Javascript), and they result in very elegant Python code when used.

There's also the fact that the SICP takes you further and deeper than any Python book would.


All times are GMT -5. The time now is 11:06 AM.