help-octave
[Top][All Lists]
Advanced

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

Re: foo_cs = foo{:} - feature or bug ? (octave-3.4.2); also, sizeof(foo{


From: Jordi Gutiérrez Hermoso
Subject: Re: foo_cs = foo{:} - feature or bug ? (octave-3.4.2); also, sizeof(foo{:})
Date: Mon, 8 Aug 2011 14:25:10 -0500

Sergei, against my better judgement, I'm going to try to help you
understand what nobody else has been able to.

And please don't respond with another screen session. If anything,
just show me the commands. I'm perfectly able to type them myself and
see what they produce without your screen session.

Suppose you have

    foo = {"omg", "lol", "brb"}

then you are making a mistake by thinking of foo{:} as a single
object. It's not a single thing. It's three separate things. It's not
an array. Internally, it's a cs-list, but that internal implementation
is not really exposed in the interpreter (e.g. you can't get
typeinfo() or class() to tell you it's a cs-list). Syntactically, it
is completely equivalent to foo{1}, foo{2}, foo{3}, except it doesn't
get echoed.

    a = foo{:}

is completely equivalent to

    a = foo{1}, foo{2}, foo{3}

and

    bar(foo{:})

is completely equivalent to

    bar(foo{1}, foo{2}, foo{3})

And that's all there is to it. The expression foo{3} refers to 3
separate things, and there are very many good reasons why it is. Stop
thinking or suggesting it should be one. Let me repeat: please don't
respond with another screen dump.

- Jordi G. H.


reply via email to

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