Re: [sage-support] Re: Held recursion

2024-08-25 Thread Nils Bruin
"hold" is going to be a rather tenuous construction anyway, because there are going to be various places where the expression will be "deholded" and there is very poor control over where those hold removals occur. It's not a very well-supported feature -- mainly because its semantic meaning is m

Re: [sage-support] Re: Held recursion

2024-08-25 Thread erentar2002
Whoops, I have sent an old version of the function by mistake. I meant to send ``` def Dt(expression1):     if len(expression1.args()) == 1 \     and expression1.args()[0]==expression1:     # if the expression has only one variable     # and that variable is the entire expression return

Re: [sage-support] Re: Held recursion

2024-08-25 Thread erentar2002
Thank you very much for your reply, i learned a lot My initial intention when asking the prior question was to define a function where some evaluations would return itself, while other evaluations would not. Such as ``` def f(x):     if x%2==0:     return hold(f(x))     else:     retu

[sage-support] Re: Held recursion

2024-08-25 Thread Nils Bruin
Dear erentar, There are two types of objects involved here: "symbolic functions" that live as objects in SR and "python functions" which are part of python itself. "hold" is only a directive that applies to symbolic expressions, whereas "def" defines a python function. Hence, the "hold" directi