revising ev, was: problem with "concatting variables"



On 09/27/2013 01:43 AM, Raymond Toy wrote:
> >>>>> "Stavros" == Stavros Macrakis <macrakis at alum.mit.edu> writes:
>  Stavros> if length("cat")=3 then a else b
>
>  Stavros> will return b. After all, the expression length("cat")
>  Stavros> does not equal 3. That will be hell to debug, especially
>  Stavros> for a beginning user.

  I agree that's a clear disadvantage. It's a general problem with
  returning the input form. But there are advantages. It's related
  to the general question of where on ought to handle errors.

>  Any reason not to extend length to work with strings?

I somehow got the idea that length is suppose to work conceptually
with part and inpart. But, part("cat",1) also gives an error

On the other hand, this does not work either:

(%i1) length(-1/4);
(%o1)                                  2
(%i2) part(-1/4,2);

part: fell off the end.
  -- an error. To debug this try: debugmode(true);
(%i3)

I use my own function ilength, which also gives the length of
some other objects. It works like this:

(%i1) ilength("cat");
Warning: ilength: Argument 'cat' at position 1 is neither a subscripted 
variable nor non-mapatomic in ilength("cat").

(%o1) ilength("cat")
(%i2) unset_match_form('ilength)$

(%i3) ilength("cat");

ilength: Argument 'cat' at position 1 is neither a subscripted variable 
nor non-mapatomic in ilength("cat").

(%i4) error_code;
(%o4) chk_or_non_mapatom_subvar


--John
>  Maxima mailing list
>  Maxima at math.utexas.edu
>  http://www.math.utexas.edu/mailman/listinfo/maxima