[sage-support] Re: Is it possible to replace the list built-in type in Sage?

2009-08-03 Thread Pierre
not supported in pure Python. However, it could add a lot of readability and programming easiness to Sage because a common task as a scientist is to manipulate and transform a lot of data and (I think) the most basic container to do that is a list. IMHO, an expression like 1 + [2,3,4,5] is

[sage-support] Re: Is it possible to replace the list built-in type in Sage?

2009-08-03 Thread Jason Grout
William Stein wrote: On Sun, Aug 2, 2009 at 9:13 AM, Robert Dodierrobert.dod...@gmail.com wrote: Robert Bradshaw wrote: Sage lists are Python lists, which are very different than Mathematica lists. You say that as if it's a fact of geography which can't be changed. to change all lists

[sage-support] Re: Is it possible to replace the list built-in type in Sage?

2009-08-02 Thread Robert Dodier
Robert Bradshaw wrote: Sage lists are Python lists, which are very different than Mathematica lists. You say that as if it's a fact of geography which can't be changed. to change all lists would be a massive (backwards- incompatible) change, as well as another step away from Python. Not

[sage-support] Re: Is it possible to replace the list built-in type in Sage?

2009-08-02 Thread William Stein
On Sun, Aug 2, 2009 at 9:13 AM, Robert Dodierrobert.dod...@gmail.com wrote: Robert Bradshaw wrote: Sage lists are Python lists, which are very different than Mathematica lists. You say that as if it's a fact of geography which can't be changed. to change all lists would be a massive

[sage-support] Re: Is it possible to replace the list built-in type in Sage?

2009-08-02 Thread Carlos Córdoba
On Sun, Aug 2, 2009 at 2:00 PM, William Stein wst...@gmail.com wrote: On Sun, Aug 2, 2009 at 9:13 AM, Robert Dodierrobert.dod...@gmail.com wrote: Robert Bradshaw wrote: Sage lists are Python lists, which are very different than Mathematica lists. You say that as if it's a fact of

[sage-support] Re: Is it possible to replace the list built-in type in Sage?

2009-07-30 Thread Offray Vladimir Luna Cárdenas
Hi, Bill Page escribió: [ x ] No, I can read the above just fine. It is crystal clear. ... but of course unnecessarily verbose. In my opinion a more common notation in Sage: sage: x=2*vector(range(10))+vector(10*[3]) sage: list_plot(map(lambda a:[cos(a),sin(a)],x/max(x))) is

[sage-support] Re: Is it possible to replace the list built-in type in Sage?

2009-07-17 Thread Carlos Córdoba
[[cos(a/9), sin(a/9)] for a in [b+3 for b in [2*c for c in [1,2,3 (This is using a/9 instead of a/max(z) since I don't know how to do 'max(z)' in a one-liner like this.) Thanks John, when I was talking about unreadable comprehensions I was meaning this. i.e. nested ones. Then was when I

[sage-support] Re: Is it possible to replace the list built-in type in Sage?

2009-07-17 Thread Laurent
Carlos Córdoba ha scritto: [[cos(a/9), sin(a/9)] for a in [b+3 for b in [2*c for c in [1,2,3 (This is using a/9 instead of a/max(z) since I don't know how to do 'max(z)' in a one-liner like this.) Thanks John, when I was talking about unreadable comprehensions I was meaning

[sage-support] Re: Is it possible to replace the list built-in type in Sage?

2009-07-16 Thread Robert Bradshaw
On Jul 14, 2009, at 3:35 PM, William Stein wrote: 2009/7/14 Carlos Córdoba ccordob...@gmail.com: Thanks John, I'd seen Python comprehensions before, but since I was trying to do all in a one-liner, I think I overlooked your elegant and simple solution. One comprehension at a time is

[sage-support] Re: Is it possible to replace the list built-in type in Sage?

2009-07-14 Thread William Stein
On Tue, Jul 14, 2009 at 3:01 AM, Paul Sargentpsa...@gmail.com wrote: On 13 Jul 2009, at 17:13, Robert Bradshaw wrote: In general, we try to avoid modifying the preparser as much as possible. Sometimes, we really have to sage: eval(1/2 + 3^2) 1 is really not acceptable (IMHO) for a

[sage-support] Re: Is it possible to replace the list built-in type in Sage?

2009-07-14 Thread Carlos Córdoba
Sorry for not answering before, I've being a bit busy. I'll try to give a concrete example of what I'm trying to do so you can understand me better. I have a list of real numbers, for example [1,2,3] I want to multiply by 2 to get [2,4,6] the to sum it to 3 [5,7,9] then divide by the max

[sage-support] Re: Is it possible to replace the list built-in type in Sage?

2009-07-14 Thread John H Palmieri
On Jul 14, 1:52 pm, Carlos Córdoba ccordob...@gmail.com wrote: Sorry for not answering before, I've being a bit busy. I'll try to give a concrete example of what I'm trying to do so you can understand me better. I have a list of real numbers, for example [1,2,3] Python list comprehensions

[sage-support] Re: Is it possible to replace the list built-in type in Sage?

2009-07-14 Thread Carlos Córdoba
Thanks John, I'd seen Python comprehensions before, but since I was trying to do all in a one-liner, I think I overlooked your elegant and simple solution. One comprehension at a time is quite neat, but several is just unreadable. On Tue, Jul 14, 2009 at 4:28 PM, John H Palmieri

[sage-support] Re: Is it possible to replace the list built-in type in Sage?

2009-07-14 Thread William Stein
2009/7/14 Carlos Córdoba ccordob...@gmail.com: Thanks John, I'd seen Python comprehensions before, but since I was trying to do all in a one-liner, I think I overlooked your elegant and simple solution. One comprehension at a time is quite neat, but several is just unreadable. That could be

[sage-support] Re: Is it possible to replace the list built-in type in Sage?

2009-07-14 Thread John H Palmieri
On Jul 14, 3:35 pm, William Stein wst...@gmail.com wrote: 2009/7/14 Carlos Córdoba ccordob...@gmail.com: Thanks John, I'd seen Python comprehensions before, but since I was trying to do all in a one-liner, I think I overlooked your elegant and simple solution. One comprehension at a time

[sage-support] Re: Is it possible to replace the list built-in type in Sage?

2009-07-14 Thread Bill Page
[ x ] No, I can read the above just fine. It is crystal clear. ... but of course unnecessarily verbose. In my opinion a more common notation in Sage: sage: x=2*vector(range(10))+vector(10*[3]) sage: list_plot(map(lambda a:[cos(a),sin(a)],x/max(x))) is superior to Mathematica. On Tue, Jul

[sage-support] Re: Is it possible to replace the list built-in type in Sage?

2009-07-14 Thread Bill Page
[ x ] No, I can read the above just fine. It is crystal clear. ... but of course unnecessarily verbose. In my opinion a more common notation in Sage: sage: x=2*vector(range(10))+vector(10*[3]) sage: list_plot(map(lambda a:[cos(a),sin(a)],x/max(x))) is superior to Mathematica. On Tue, Jul

[sage-support] Re: Is it possible to replace the list built-in type in Sage?

2009-07-13 Thread Harald Schilly
On Jul 12, 9:05 pm, Carlos Córdoba ccordob...@gmail.com wrote: Thanks for your quick answers. Coming from Mathematica, I was expecting to add lists as vectors, multiply real numbers by lists, etc, without sub-classing or using another types (such as vectors in sage) just to clarify this,

[sage-support] Re: Is it possible to replace the list built-in type in Sage?

2009-07-13 Thread Robert Bradshaw
On Jul 12, 2009, at 2:49 PM, Kevin Horton wrote: Carlos Córdoba wrote: Thanks for your quick answers. Coming from Mathematica, I was expecting to add lists as vectors, multiply real numbers by lists, etc, without sub-classing or using another types (such as vectors in sage) Sage lists

[sage-support] Re: Is it possible to replace the list built-in type in Sage?

2009-07-12 Thread Carlos Córdoba
Thanks for your quick answers. Coming from Mathematica, I was expecting to add lists as vectors, multiply real numbers by lists, etc, without sub-classing or using another types (such as vectors in sage) Do you advise me to add things to the preparser to have this behaviour or not? If so, how can

[sage-support] Re: Is it possible to replace the list built-in type in Sage?

2009-07-12 Thread Kevin Horton
Carlos Córdoba wrote: Thanks for your quick answers. Coming from Mathematica, I was expecting to add lists as vectors, multiply real numbers by lists, etc, without sub-classing or using another types (such as vectors in sage) Do you advise me to add things to the preparser to have this