- Subject: Re: jed 0.99-17 looks good
 
- From: "John E. Davis" <davis@xxxxxxxxxxxxx>
 
- Date: Thu, 25 Nov 2004 21:06:08 -0500
 
Paul Boekholt <p.boekholt@xxxxxxxxx> wrote:
>This raises two questions:
>-is something wrong with integer()?
  I do not believe that anything is wrong with integer.  If you can
find an example where it incorrectly parses its input, then let me
know what it is.  I can probably add something like "atoi" that will
not perform any error checking on its input.
>-how do I catch an error in an array_map?
A more robust alternative to
	files = array_map(Integer_Type, &integer, files);
would be to use a function other than integer, e.g.,
  define my_integer (str)
  {
     try return integer (str);
     catch ParseError:
      return -1;
  }
Or, you can use something like:
  types = array_map (DataType_Type, _slang_guess_type, files);
  files = array_map(Integer_Type, &integer, 
                    files[where(types==Integer_Type)]);
If you want filenames that consist only of digits, then the
string_match function might be your best bet.
--John
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
  [2004 date index]
  [2004 thread index]
  
  [Thread Prev] [Thread Next]
      
  [Date Prev] [Date Next]