From bug-octave-request at bevo dot che dot wisc dot edu Fri Jan 15 14:53:42 1999 Subject: Re: [lost mail? ]`list' behaviour different in octave-2.1.10 and2.1.12 From: Joao Cardoso To: "A. Scottedward Hodel" CC: bug-octave at bevo dot che dot wisc dot edu Date: Fri, 15 Jan 1999 20:53:31 +0000 A. Scottedward Hodel wrote: > > John and I hashed this over a bit when he added the list data structure. > The problem is a discrepancy in 2.1.10 between what happens when you say > > a = list(...) > x = a(2) > x = a([2 3 4]) > 2.1.12 returns a list for both of these, while 2.1.10 returns a the > list value for the first. That can lead to lots of irritating problems > when doing list operations, since if an index vector drops to length 1 you > get a value instead of a list with a single value. > > The new list function "nth" replaces the singleton case: > > x = nth(a,2) > > will do what you want, and allows the above list operations to > consistently return lists, even if there's only one item in the list. > I think the matlab cell structure requires a similar kind of operation, > but I haven't used it in several months so I don't recall the details. ... Thanks, I missed that (terse description) new function in the ChangeLog. I guess that lists are still going to evolve. Joao -- Joao Cardoso | e-mail: jcardoso at inescn dot pt INESC, R. Jose Falcao 110 | tel: + 351 2 2094322 4050 Porto, Portugal | fax: + 351 2 2008487