Dave Gudeman wrote:
>
> list(n,v,i)
>
> creates a list of n slots each containing the value v if i is null,
> otherwise i must be a non-negative integer and each slot of n contains a
> copy of v, copied to the depth i. If i is 0, then it is a complete copy.
>
I think that somebody suggested to do the same thing with
copy(x,i).
After reading this and notes by Steve and Clint a series of
thoughts occurred to me on the idea of depth and copying.
In Icon with lists and strings it's possible to use whole number
and negative indexing.
This could extend to depth and copying in list(n,v,i) and
deepcopy. Negative values of i could be interpreted similarly and
in doing so would be consistent with these other models. For
example copy(x,-1) would copy all but the last level of x.
The idea makes sense for n-dimensional and tree-like objects.
The concept and meaning seem clear. But for objects with loops,
the loop would either be copied or not depending upon the 'depth'
of the copy. Is there any larger meaning for this when objects
have loops?
Next, would it be worth it? Or, more specifically would there be
an application for this extension of 2-dimensional indexing into
a 3rd dimension? (Sorry for overloading the term dimension
here).
In order to do this (use negatives) it would be necessary to
determine the 'depth' of a structure. Now this is an interesting
thought. We don't have an operator for it. We can determine
size easily and generally but depth is different. Values like
&null, numerics, strings, etc. have a depth of 1. Structures can
be more. Would a general depth function/operator be useful? (
**x jumped to mind but it is obviously ambiguous and flawed. Or
for that matter, how would someone propose disambiguating ==b as
either ==b or =(=b)? )
This brings me back to the 3-tiers used in Godiva. They're
simple and make sense. Going beyond that starts raising these
kinds of questions. Or at least starts requiring more
documentation for newbies.
David Gamey
_______________________________________________
Unicon-group mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/mailman/listinfo/unicon-group