You mean like PHP? %sage notebook code notebook code notebook code
%html ... ... %sage notebook code notebook code Would you be allowed to switch contexts within a control structure? class foo: %sagex #this is useful def bar(self,n): return n*n %sage def baz(self,m): n = float(m^3) #that's an exponent %sagex #getting ugly... cdef double p p = n**(-2) n = p - n %python #holy crap k = int(n*100000) k = k ^ int(m) #that's an xor return p*k I kinda like how pyrex does it. Maybe you could _judiciously_ add a few new defs. xdef -> sagex fdef -> f2py wdef -> weave ... I think the coolest thing about sage is that it's native language is python. I personally believe that any programmer worth h(er|is) salt should be able to rapidly switch between 3 to 10 languages at a time. However, that's a poor philosophy when one wants to attract student programmers, or worse, SAGE users (mathematicians, many of whom don't trust computers already). > %sagex # switch to SageX > def foo(n,m): > k = n*m > c-library calls > cdef int i. > etc. > return k > %sage # switch back to SAGE > a = 17 > print foo(3,7) > What do you think? Basically, I'm suggesting extending the % syntax > from the SAGE notebook to .sage files. If nothing else, it would > mean that when I edit a file with embeded SageX code, it would still > get nice syntax hilighting in emacs... > There could also be a %weave mode, etc. And the % mode code take > arguments, e.g., > %weave(compiler="CC") > Note that I think this would all be pretty easy to implement. > William > > --~--~---------~--~----~------------~-------~--~----~ 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://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---