Robert Bradshaw wrote:
> On Oct 21, 2009, at 3:13 PM, Jason Grout wrote:
> 
>> William Stein wrote:
>>> On Wed, Oct 21, 2009 at 11:54 AM, Jason Grout
>>> <jason-s...@creativetrax.com> wrote:
>>>> (Yet again) I tried to pull up an @interact from the wiki and it  
>>>> didn't
>>>> work because it had not been updated to keep up with the changes to
>>>> syntax in Sage.  Are there any objections to making a file of the
>>>> @interact examples so that it is easy to spot when they need to be
>>>> updated through normal doctesting?
>>> How would it work?  What would you put in the file.
>>>
>>> I think it would be much better to make a while directory in the main
>>> Sage tree of examples, along
>>> with an organized namespace, e.g., something like
>>>
>>>    sage: interacts.<tab>
>>>    sage: interacts.calculus.<tab>
>>>    sage: interacts.calculus.derivative()
>>>    up pops the interact
>>>
>>> Regarding doctesting, that may require some extension to how interact
>>> works?   I.e., some special function like
>>>
>>>    sage: interacts.calculus.derivative.test()
>>>
>>> that would do something clever.
> 
> That would be cool.
> 
>> Nice idea!
>>
>> As things are right now, if I define an interact function
>>
>> interacts.calculus.vector_motion_2d
>>
>> then someone could call it up by:
>>
>> interact(interacts.calculus.vector_motion_2d)
> 
> I'd prefer interacts.calculus.vector_motion_2d() to  
> interact(interacts.calculus.vector_motion_2d)


Two comments:

(1) as it is now, interacts.calculus.vector_motion_2d(a=1,b=2) would 
produce usable output with those parameter values (no sliders, but the 
function would work), so the function is a nice function as well as an 
interact.

(2) interact() does all of its work when it wraps the function, so the 
interact system would need some tinkering to make your option work, 
while interact(interacts.calculus.vector_motion_2d) works now.

To take care of option 2, it seems like we could either redo some of the 
interact functionality, or we could define a library_interact decorator 
that embeds the interact functionality into the function call, rather 
than the function definition.

However, (1) makes me lean towards what I proposed.

Does that change your mind?

Thanks,

Jason




-- 
Jason Grout


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to