help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: is octave compatible with matlab 5.2?


From: Jonathan King
Subject: Re: Re: is octave compatible with matlab 5.2?
Date: Tue, 23 Mar 1999 14:01:06 -0800

>Thanks for writing the clarification; I was being brief (a.k.a. lazy).

:-)

[snip]

>>foo=list([1,2], list([3,4]))
>>
>>But lists *are* bleeding edge; so far, I haven't found a way to get
>>stuff out of lists. :-(  so foo(2) in the above doesn't return a
>>list of one item.  Neither does foo(2)(1).
>
>The "nth" function is what you're looking for (returns the nth
>element in a list).

OK.  I was expecting behavior such that foo(1) = car(foo) rather
than nth(foo,1) = car(foo).  (Where "car" is the traditional "first"
item function in most lisps.)  But I can see the justification for
things like:

>JWE and exchanged a bunch of email on how to handle this.  
>
>    x=1:3; foo(x)         returns a list

which I guess really does do what you expect it should.  And I
understand the not wanting to special-case matrices of length one.

>    x = 1; foo(x)
>Should this be a list of a singleton?  For consistency, we decided
>    on a list of length 1; use the nth function to get the singleton.

Interesting.  Well, it's easy enough to implement car, cdr, and
append (I just did it...).  But is there a function that returns
"true" for a list?  (I couldn't find it, but I'm a little hopeful
that one exists, somewhere...)

jking



reply via email to

[Prev in Thread] Current Thread [Next in Thread]