Re: newbie: working iwth list of tuples

2006-01-29 Thread falcon
Wow, great answers here. Thank you all for the links and examples, I'm going through them all now. -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie: working iwth list of tuples

2006-01-29 Thread Kent Johnson
falcon wrote: > Hi All, > I am fairly new to Python (less than a week). My goal is to write a > small prototype of a database. Rather than build it using the typical > method where one provides selection, projection, aggregation, union, > intersection, etc. functions, I would like to do it in a m

Re: newbie: working iwth list of tuples

2006-01-29 Thread Raymond Hettinger
[Raymond Hettinger] > > Parameterized filter, extract, and reduce functions can be handled in a > > like manner. > > Just for grins, here is a more worked-out example: See the ASPN Cookbook recipe for a version with doctests and a couple bug-fixes: http://aspn.activestate.com/ASPN/Cookbook/Pyt

Re: newbie: working iwth list of tuples

2006-01-29 Thread John Bauman
"Paul Rubin" wrote in message news:[EMAIL PROTECTED] > "falcon" <[EMAIL PROTECTED]> writes: >> I forgot to add that I passing a tuple of functions to the reduce >> function but apparently that is not allowed. My guess was that a tuple >> made up of individual (simple)

Re: newbie: working iwth list of tuples

2006-01-29 Thread Raymond Hettinger
[Raymond Hettinger] > Parameterized filter, extract, and reduce functions can be handled in a > like manner. Just for grins, here is a more worked-out example: def pfunc(inputfields, operation): "Parameterized computation of a new field" # For example, append a field that is the sum of fi

Re: newbie: working iwth list of tuples

2006-01-28 Thread Raymond Hettinger
[falcon] > I am fairly new to Python (less than a week). My goal is to write a > small prototype of a database. Rather than build it using the typical > method where one provides selection, projection, aggregation, union, > intersection, etc. functions, I would like to do it in a more > 'function

Re: newbie: working iwth list of tuples

2006-01-28 Thread Paul Rubin
"falcon" <[EMAIL PROTECTED]> writes: > I forgot to add that I passing a tuple of functions to the reduce > function but apparently that is not allowed. My guess was that a tuple > made up of individual (simple) functions might be easier to manipulate > programatically than a function which has to

Re: newbie: working iwth list of tuples

2006-01-28 Thread falcon
I forgot to add that I passing a tuple of functions to the reduce function but apparently that is not allowed. My guess was that a tuple made up of individual (simple) functions might be easier to manipulate programatically than a function which has to know the structure of a list. (My test code)

Re: newbie: working iwth list of tuples

2006-01-28 Thread Paul Rubin
"falcon" <[EMAIL PROTECTED]> writes: > I didn't find any examples of using idioms from functional programming > beyond basic explanation of reduce and map (I have a couple of Haskell > and ML books, but I know those languages even less than Python). The book you really want is SICP, http://mitpre

newbie: working iwth list of tuples

2006-01-28 Thread falcon
Hi All, I am fairly new to Python (less than a week). My goal is to write a small prototype of a database. Rather than build it using the typical method where one provides selection, projection, aggregation, union, intersection, etc. functions, I would like to do it in a more 'functional' style (