Hi Prof. Lee and hackers, Yes - I understand the resulting array has length zero; what I didn't get was why this creates a problem. I expected that if myArr == {}, then myArr.length() should evaluate to 0. For arrays of length >= 1, this expression returns the expected positive integer.
A mid-August 2004 thread, "zero-length arrays", covers this. It seems they are not "supported" (the discussion considers whether this is a good idea in the first place). I'm still getting to know the type system, so I don't grasp everything discussed - zero-length arrays can obviously occur, but other aspects of the typesys / exprlang do not handle them. So, now I'm trying different things to find another way of doing this sort of filtering. To fully understand the root of the error will take a bit more digging ;-) It's right there on line 76 of ArrayToken.java, though - constructing a new one with value.length == 0 is a no-no... Thanks, Chuck -----Original Message----- From: Edward A. Lee [mailto:[EMAIL PROTECTED] Sent: Monday, May 15, 2006 12:52 PM To: Lutz, Charles D Cc: ptolemy-hackers@bennett.EECS.Berkeley.EDU Subject: Re: Error: "The length of the specified array is zero." Looks like "Russian" is not in your dressingsList. Hence, you get a length zero array. Edward At 10:30 AM 5/12/2006, Lutz, Charles D wrote: >Hi folks, > >I'm trying to figure out what is wrong in the >attached model; I am trying to extract an >element from an array, and from what I can tell, I think it should work. > >The problem occurs with both ArrayElement and >ArrayLength (I haven't tested with >similar other actors). Without one of these in >the path, I get tokens of the form e.g. >{4} on the "Found Indices" display. This looks >like an array of length 1. As soon as I >insert ArrayElement or ArrayLength in the flow, >I get an error, "The length of the >specified array is zero." > >I've been stepping through this in Eclipse but I >haven't found where the problem occurs. > >Again, it seems like what is coming out of the >Expression actor are in fact arrays, so >ArrayLength (or similar) should be happy... am I missing something basic? > >Thanks for any tips, > >Chuck Lutz >Lockheed Martin >Systems of Systems - Modeling and Operations Analysis >BMC4I Modeling and Simulation >Moorestown, NJ >(856)638-7234 (office) ><mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED] > >"Everyone spoke of an information overload, but what there >was in fact was a non-information overload." >- Richard Saul Wurman > ------------ Edward A. Lee Professor, Chair of the EE Division, Associate Chair of EECS 231 Cory Hall, UC Berkeley, Berkeley, CA 94720-1770 phone: 510-642-0253 or 510-642-0455, fax: 510-642-2845 [EMAIL PROTECTED], http://ptolemy.eecs.berkeley.edu/~eal ---------------------------------------------------------------------------- Posted to the ptolemy-hackers mailing list. Please send administrative mail for this list to: [EMAIL PROTECTED]