Void in Maxima



My proposal does not make anything impossible.  I did not say that it would be a panacea to have the ability to return nothing but I think the opposite.  It would make Maxima programming more flexible.  Right now you have to return something even when you don't want to.

Rich

  ----- Original Message ----- 
  From: Stavros Macrakis 
  To: Richard Hennessy 
  Cc: Maxima List 
  Sent: Monday, October 05, 2009 12:02 AM
  Subject: Re: [Maxima] Void in Maxima


  So the whole point of this peculiar scheme is to avoid inf/inf etc. giving a nonsense result?  I would rather have inf be handled correctly, so that inf+inf=>inf, inf+0=>inf, inf/inf => und, etc. with possibly an option for signalling an error when und is returned.

  Your proposal would also make all sorts of useful programs impossible, e.g. if limit(...)=inf then ...

               -s

  PS Please feel free to continue the discussion with others, but I will not be participating any further.


  On Sun, Oct 4, 2009 at 11:43 PM, Richard Hennessy <rich.hennessy at verizon.net> wrote:

    All of the examples you give of using void in an expression or as a function argument or in an nary operation would generate the same3 error.

    f(void);
    Maxima encountered a lisp error. Attempt to operate on void.  An error. Automatically continuing.

    or void + 1, void * 4, void/void or void * 0 or anything else.  The only legal thing you can do with void is return it to indicate no return value.

    If limit used void for example you could do this.

    (%i1) limit(-x^2,x,inf);
                                -infinity
    (%i2) %*2.
    Maxima encountered a lisp error. Attempt to operate on void.  An error. Automatically continuing.
    (%i2)

    By way of this example limit displays with disp() the answer i.e. disp("-infinity"), then returns void so no one could try to use the answer in a future calculation.  -infinity is really a message to the user telling the answer.  It is not a value.

    Rich


      
      ----- Original Message ----- 
      From: Stavros Macrakis 
      To: Richard Hennessy 
      Cc: Maxima List 
      Sent: Sunday, October 04, 2009 10:56 PM
      Subject: Re: [Maxima] Void in Maxima


      Having some sort of non-printing "void" value is of course doable.

      Presumably the main value of such a thing would be for calculations that really have no result.  OK, a nice little convenience.  Then we'd have to define the meaning of this thing when combined with other things.  What is %void+1? %void/%void? if %void then 1 else 0? length(%void), f(%void), etc.  And then implement all those things -- remember, Maxima internally is not object-oriented in the sense that every operation on a type of object is centralized under the type definition.  All doable, but a bunch of work.  It doesn't seem worth it to me, but perhaps there is an argument for it.

      A *completely different* topic is non-numerical but perfectly meaningful values such as inf. limit(x^-2,x,0) really is inf.  It is not undefined, it is not an error; it is inf.  Yes, I know, in the usual presentations of calculus, inf is not a value, but a notation.  But Maxima doesn't follow the usual presentation..... Und and ind, similarly, are not the usual mathematical conventions for dealing with things like limit(tan(x),x,inf) and limit(sin(x),x,inf) -- but they are perfectly reasonable conventions, and again not errors, and not null values.

      And how exactly would %void "handle all of the problems with 'und..."?  It sounds like it would do it simply by replacing them with "problems with %void"...!

                -s


      On Sun, Oct 4, 2009 at 10:06 PM, Richard Hennessy <rich.hennessy at verizon.net> wrote:

        What about the possibility of creating a new system variable called void or %void that would have the properties that I described.  I think this is desirable because many times I think a function should not return a value when the function fails at its job.  This might be a way to resolve how to handle all of the problems with 'und, 'ind, 'inf and 'minf.

        Rich

          ----- Original Message ----- 
          From: Stavros Macrakis 
          To: Richard Hennessy 
          Cc: Maxima List 
          Sent: Sunday, October 04, 2009 11:00 AM
          Subject: Re: [Maxima] Void in Maxima


          On Sun, Oct 4, 2009 at 9:09 AM, Richard Hennessy <rich.hennessy at verizon.net> wrote:

            Is there a way to cause a function to have no return value.


          No.

          It is possible to create a symbol of length 0 using ?intern("$") which has a zero-length printed form, but this has none of the properties you want.

                   -s



----------------------------------------------------------------------


          _______________________________________________
          Maxima mailing list
          Maxima at math.utexas.edu
          http://www.math.utexas.edu/mailman/listinfo/maxima





--------------------------------------------------------------------------


      _______________________________________________
      Maxima mailing list
      Maxima at math.utexas.edu
      http://www.math.utexas.edu/mailman/listinfo/maxima





------------------------------------------------------------------------------


  _______________________________________________
  Maxima mailing list
  Maxima at math.utexas.edu
  http://www.math.utexas.edu/mailman/listinfo/maxima