help-octave
[Top][All Lists]
Advanced

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

Re: lists and cell arrays ?


From: taltman
Subject: Re: lists and cell arrays ?
Date: Wed, 19 Nov 2003 19:46:59 +0000 (UTC)

I think that I'm getting confused. Are we talking about "user defined
types" in the C++/OCT-file sense, or in the "Octave interpreter"
sense?

As Octave stands now, I can create a binary tree data type just from
the interpreter, using nested cell-arrays. I don't believe there are
any of those operators that would work with my whipped-up data
type. :-)

Of course, I could create ways to make equivalent functions work
(a.k.a., "add-tree" in lieu of the "+" operator ), but it's not the
same as it being something built-in to the interpreter, with its own syntax.

So, when you refer to user data types, are these data types which are
added via OCT-files?

~Tomer


On Nov 19, 2003 at 1:38pm, John W. Eaton wrote:

jwe >Date: Wed, 19 Nov 2003 13:38:39 -0600
jwe >From: John W. Eaton <address@hidden>
jwe >To: address@hidden
jwe >Cc: David Bateman <address@hidden>,
jwe >     Michael Creel <address@hidden>, address@hidden
jwe >Subject: Re: lists and cell arrays ?
jwe >
jwe >On 19-Nov-2003, address@hidden <address@hidden> wrote:
jwe >
jwe >| I think you're talking about two things here. Built-in types
jwe >| vs. user-defined data structures. Octave's data types, namely,
jwe >| strings, matrices, cell-arrays, (deprecated) lists, and
jwe >| associative-arrays (aka "structs"), should have high-level syntax for
jwe >| concatenation & other useful functions. I don't believe that it's
jwe >| possible for a programming language to have standard operators for
jwe >| user-defined abstract data structures, since a wily user can create
jwe >| all sorts of crazy data schemes. :-)
jwe >
jwe >I don't think I understand your objection.  We allow user defined
jwe >types to take advantage of other syntax like +, -, *, /, etc. so I
jwe >see no reason that
jwe >
jwe >  [a, b]
jwe >
jwe >should not have the same treatment.  It could easily expand to
jwe >
jwe >  horzcat (a, b)
jwe >
jwe >for objects a and b.  If horzcat were limited to just two args, we
jwe >could have a table of operators and dispatch on both argument types,
jwe >same as for other binary operators.  If we allow horzcat to have any
jwe >number of arguments (required for compatibility, I think) then for
jwe >user-defined types in C++, we can have a virtual horzcat method and
jwe >dispatch on the type of the first argument. If we ever have
jwe >user-defined types in the scripting langauge, then we will look for a
jwe >horzcat method for the user-defined type and call that if it is
jwe >available.
jwe >
jwe >jwe
jwe >



-------------------------------------------------------------
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
-------------------------------------------------------------



reply via email to

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