From the discussion in sage-support (which I mistook for sage-devel).

On 02/09/2008, at 6:22, Robert Dodier <[EMAIL PROTECTED]> wrote:
> * sets and matrices not distinguished from lists

Mathematica's attributes are something I will miss in Sage.  (They are  
a partial fix for some of the problems with a lack of a good "Set")

If I instruct mathematica:
SetAttributes[set, Orderless]

Now create s = set[a,c, b].  It is automatically reordered to s ==  
set[a, b, c].  Because of the attribute "Orderless", nice things like  
set[a, c, b] == set[c, b, a] are automatically true.

There are a number of other useful "Attributes".  For example:
Let "f" be some undefined function.  f[1] remains unevaluated.  "N" is  
the "to_float" function, so that e.g. N[2] -> 2.0.  So N[f[1]] becomes  
f[1.0].

However, if I give f the attribute "NHoldAll", N does not descend into  
f, so N[f[1]] is f[1].

This is useful for defining things like quantum operators, where you  
might want to convert an expression's coefficient into a floating  
point number, without converting any spin quantum numbers inside that  
expression to inexact quantities.

Attributes are not unlike the __ __ members in python.  I think there  
might be a case for a few well-defined mathematical __ __ members  
appearing widely in sage---the obvious ones are related to the  
counterparts of mathematica's N and Hold.  It might already be the case.

D

==================================
David J Philp
Postdoctoral Fellow
National Centre for Epidemiology and Population Health
Building 62, cnr Mills Rd & Eggleston Rd
The Australian National University
Canberra ACT 0200 Australia

T: +61 2 6125 8260
F: +61 2 6125 0740
M: 0423 535 397
W: http://nceph.anu.edu.au/

CRICOS Provider #00120C





--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to