Void in Maxima



Incidentally regarding pw() and pwsimp() I compromised by sometimes 
returning an expression or value and sometimes doing a side effect and then 
just returning done.

Rich


----- Original Message ----- 
From: "Richard Hennessy" <rich.hennessy at verizon.net>
To: "Maxima List" <maxima at math.utexas.edu>; "Richard Fateman" 
<fateman at cs.berkeley.edu>
Sent: Monday, October 05, 2009 10:58 AM
Subject: Re: [Maxima] Void in Maxima


>I was thinking about something like this.
>
> f(x):= block(if x=1 then void else 2)$
>
> This is sort of like a subroutine and sort of like a function.  It can be
> either which is consistent with the general behavior of Maxima which 
> allows
> mixing things up.  f(x) would be a weakly typed function or subroutine
> depending on what it wants to be at the time or depending on the inputs. 
> I
> have wanted the pw() and pwsimp() functions to have this flexibility but I
> am frustrated with that since there is no way to do it.
>
> Rich
>
>
> ----- Original Message ----- 
> From: "Richard Fateman" <fateman at cs.berkeley.edu>
> To: "Richard Hennessy" <rich.hennessy at verizon.net>
> Sent: Monday, October 05, 2009 10:48 AM
> Subject: Re: [Maxima] Void in Maxima
>
>
>> In lisp, a function can return "no values"   or one (the usual case) or
>> several.
>> This is done with the (values... )  construction.
>>
>> However, there is another role played by "returning", which is to alter
>> the flow of control from "do the next statement in line"  to
>> "do the next statement after the call to the function".    If you want to
>> change the latter, you need to use something like
>> goto, catch/throw, or errorset/error.
>>
>> Having a situation in which something is not printed seems like a "throw"
>> to the top-level loop.
>>
>> RJF
>> Richard Hennessy wrote:
>>> Maybe the idea is too hard to implement as this point.  If there was an
>>> way to do it I without so much effort it would have been a good idea.
>>>
>>> Rich
>>>
>>> ----- Original Message ----- From: "Richard Fateman"
>>> <fateman at cs.berkeley.edu>
>>> To: "Barton Willis" <willisb at unk.edu>
>>> Cc: "Richard Hennessy" <rich.hennessy at verizon.net>; "Maxima List"
>>> <maxima at math.utexas.edu>
>>> Sent: Monday, October 05, 2009 10:04 AM
>>> Subject: Re: [Maxima] Void in Maxima
>>>
>>>
>>>> what may not be clear to everyone in this discussion is that adding a
>>>> new object with special properties like the ones suggested for "void"
>>>> requires an examination of many places in Maxima.
>>>> For example, the instructions for simplifying "void + x"  would not be
>>>> encoded in the object "void".  These are encoded on the property list 
>>>> of
>>>> the object "+".
>>>> Thus to make "void", or for that matter, inf, und, ind, intervals, etc
>>>> work, one has to modify +, *, sin, cos, exp, log, integrate, diff, etc
>>>> etc etc.
>>>>
>>>> Now maybe this organization is wrong, but that's the way it is.
>>>> (arguing about whether cos(void)  should send a "void" message to "cos"
>>>> or a "cos" method to "void" does not
>>>> offer a solution to  "void+infinity+interval(-1,1)")
>>>>
>>>
>>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima