On Fri, 9 Nov 2012, Allin Cottrell wrote:
On Fri, 9 Nov 2012, Sven Schreiber wrote:
> Am 09.11.2012 18:17, schrieb Allin Cottrell:
>> On Fri, 9 Nov 2012, Sven Schreiber wrote:
>>>
>>> I'm not saying I need it, but it isn't obvious to me why it is less
>>> useful in principle than for example 'isstring()'. Instead it seems
to
>>> be a natural complement to the other 'is...()' functions, doesn't
it?
>>
>> Maybe I was too glib. But actually, it seems to me that all we
>> really need is isnull() --
>
> [followed by more detail]
>
> Hm, not sure, but what about the case of analyzing the components of
> bundles in a script? Maybe the bundle itself is a function argument, and
> then the function needs to check the sanity of the structure of the
> bundle that was passed in?
Point taken. I need to think about that. If it's valid I guess
we should add ismatrix and isbundle? Or, perhaps better, roll
these distinct functions into something we might call typeof?
if typeof(whatever) != "scalar"
...
endif
I like this. Moreover: sometimes we run into trouble because automatic
re-casting of a scalar as a 1x1 matrix doesn't work. For example:
<hansl>
scalar c = 5
matrix x = invpd(c)
</hansl>
now works, but it wouldn't not so long ago (invpd would complain its
argument should have been a matrix). Of course the above not working was a
bug, and was killed as such, but sometimes it's nice to have a workaround
while the bug is still there.
The only think I'd change from Allin's proposal is to introduce an
integer-based coding system, such as 1=scalar, 2=series etc and have
typeof() return a scalar. For performance reasons, the less we use
strings, the better.
--------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
--------------------------------------------------