Mike Hansen wrote: > Hello, > > On Nov 14, 12:26 am, Jason Grout <[EMAIL PROTECTED]> wrote: >> Franco Saliola wrote: >> >>>> Any comments or objections? >>> What about list comprehensions? Something like the following. >>> sage: var('i,n') >>> (i, n) >>> sage: sum(2^i for i in range(n+1)) >>> 2^(n+1) - 1 >>> I ask because this seems like the natural/first thing a user would try. >> It's consistent: >> >> sage: sum(i for i in range(10)) >> 45 >> >> However, range would have to also be overridden here, since range only >> accepts integers. >> >> Or we could override the ellipsis notation: >> >> sum(i for i in (1..oo)) >> >> sum(i for i in (1..n+1)) > > I don't think any of these are even feasible or what we want since > they create a "black box" generator which gets passed into sum.
I agree that they probably aren't feasible. I was throwing them out for the purposes of brainstorming for interfaces. Jason --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---