[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Question about the list object.

**From**: |
Mats Jansson |

**Subject**: |
Question about the list object. |

**Date**: |
Sun, 09 Sep 2001 23:32:26 +0200 |

If this has been discussed before, please point me to the discussion.
If 'l' is a list, 'l(1)' returns a list of length 1. This is logical
because e.g. 'l(1:3)' must return a list. I thought the assignment
'l(1) = list (1)' should assign the value 1 to the first element of
the list, but it doesn't. In fact 'l(1) = l(1)' changes the list 'l'.
Is this a desired behavior?
Regards
Mats
octave:82> l = list (1, 2, 3)
l =
(
[1] = 1
[2] = 2
[3] = 3
)
octave:83> l(1) = l(1)
l =
(
[1] =
(
[1] = 1
)
[2] = 2
[3] = 3
)
octave:84> l(1:2) = list ("a", "b")
error: invalid conversion from range to real scalar
error: octave_base_value::int_value (): wrong type argument `range'
error: list index must be an integer
error: evaluating assignment expression near line 84, column 8
octave:84>
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------

[Prev in Thread] |
**Current Thread** |
[Next in Thread] |

**Question about the list object.**,
*Mats Jansson* **<=**