Re: [SLUG] Semi-experienced Python Programmers?

From: Dylan William Hardison (dylan@hardison.net)
Date: Thu Jan 31 2008 - 10:26:35 EST


Spake Paul M Foster on Wednesday, January 30, 2008 at 03:41PM -0500:
> Ugh, functional programming. Interesting geeky idea, but not for a general
> purpose programming language.
Right now, maybe that's true. But there are things you can do with functional
programming -- such as automatic parallelism due to purity -- that are not
possible with imperative languages, and that are only going to get more
important as we keep adding cores to CPUs

Software transactional memory is just one benefit that (pure) functional
programming has helped to create. It is entirely possible to write a program that
makes use of parallelism as a /side effect/ of using haskell; and you won't have
to worry about race conditions/mutexes either. :)

> If I'm going to perform a task, in code or in life, I'm going to proceed on a
> step-by-step basis, describing each step in order and using the results from
> prior steps in executing the following steps.

So you prefer:

xs = []
for x in range(10): xs.append(x * 20)

to this?

xs = [x * 20 for x in range(10) ]

or this?

xs = map(lambda x: x * 20, range(10))

I prefer the list comprehension syntax, especially when manipulating large or
complicated sets of data.

> Functional programming only barely adheres to that paradigm. I'd have to think
> an entirely different way about life or coding tasks in order to implement
> functional programming. But I don't wanna.
Functional programming is a different, but equivalent, paradigm. Anything that
you can express with a turing machine you can express within the lambda
calculus. We also have several hundred years worth of mathematical reasoning
which we can apply to functional programming.

> As far as I can tell, the only widely accepted "major" paradigm shift in
> programming languages in the last 35 years (how long I've been coding) has
> been object oriented programming. Thus we see C++ and Java (and bolt-ons
> to PHP, Perl, Python and the like) shouldering more and more of the
> programming code written.

Object orientation is actually bolted on to C++ and Java, and less so on
Python... At least everything in python is/behaves like an object.

Well, almost everything. You cannot use computation as a value in python, short
of using a thunk, which isn't the same.

-- 
"I hear and I forget.
 I see and I remember.
 I do and I understand." 
             -- Confucius 
-
GPG Fingerprint: 412C CCE9 DDA2 4FE9 C34F  754B 0863 0EA6 712E BBE1
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS).  Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:29:43 EDT