#11776: Holding an expression unevaluated: Something like hold_all() would be 
nice.
---------------------------+------------------------------------------------
   Reporter:  Pap          |          Owner:  jason     
       Type:  enhancement  |         Status:  new       
   Priority:  minor        |      Milestone:  sage-4.7.2
  Component:  misc         |       Keywords:            
Work_issues:               |       Upstream:  N/A       
   Reviewer:               |         Author:            
     Merged:               |   Dependencies:            
---------------------------+------------------------------------------------

Comment(by nbruin):

 Given that {{{expression}}} is already evaluated (leading to a simplified
 expression) before {{{hold_all}}} even gets a hold of it, this approach is
 a little problematic. The basic feature is already available, but perhaps
 not very convenient for your taste. See {{{sin(pi,hold=True)}}}. Currently
 this isn't available for integrals etc., but there is
 {{{sage.calculus.calculus.dummy_integrate(x^2+1,x)}}}
 It is very reasonable to ask for {{{integrate(x^2+1,x,hold=True)}}} to be
 synonymous with that.

 You can already do
 {{{
 def held(f):
     return lambda *args: f(*args,hold=True)
 sin=held(sin)
 cos=held(cos)
 sin(pi)^2+cos(pi)^2
 }}}
 one could have a package inert_symbolic_functions that has (essentially)
 those declarations, so that a
 {{{
 from held_symbolic_functions import *
 }}}
 would give you a "held" environment. With a little namespace injection
 magic one could probably also use that to implement
 {{{
 with held_function_context:
    expr=sin(pi)^2+cos(pi)^2
 }}}
 which is probably the closest to what you request, subject to being doable
 in python.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11776#comment:1>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to