On Wednesday, March 26, 2014 10:00:21 AM UTC+5:30, Terry Reedy wrote: > On 3/25/2014 8:12 PM, Steven D'Aprano wrote: > > On Tue, 25 Mar 2014 19:55:39 -0400, Terry Reedy wrote: > >> On 3/25/2014 11:18 AM, Steven D'Aprano wrote: > >>> The thing is, we can't just create a ∑ function, because it doesn't > >>> work the way the summation operator works. The problem is that we would > >>> want syntactic support, so we could write something like this: > >>> p = 2 > >>> ∑(n, 1, 10, n**p) > >> Of course we can. If we do not insist on separating the dummy name from > >> the expression that contains it. this works. > >> def sigma(low, high, func): > >> sum = 0 > >> for i in range(low, high+1): > >> sum += func(i) > >> return sum > > There is no expression there. There is a function. > > You cannot pass an expression to a function in Python,
> One passes an unquoted expression in code by quoting it with either > lambda, paired quote marks (Lisp used a single '), or using it in a form > that implicitly quotes it (that includes def statements). Unquoted > expressions in statements ultimately get passed to an internal functions. I wrote about the two styles of quoting here: (Yeah its under the scheme banner) http://blog.languager.org/2013/08/applying-si-on-sicp.html There was also a neat little tech report by David Gries from Cornell explaining that λ ∀ Σ ∫ are all 'binding-constructs' in their own sphere's [No access to that any more though :-( ] -- https://mail.python.org/mailman/listinfo/python-list