Lists in Transcript
Dar Scott
dsc at swcp.com
Mon May 23 18:15:40 EDT 2005
On May 23, 2005, at 3:56 PM, Ruslan Zasukhin wrote:
> Sending of many parameters is not equivalent
>
> Because if you have list
>
> v = [v1, v2, ... ]
>
> This is an object, like array you have.
> You can use it many times, you can modify it and so on.
It is not equivalent. But it is an option in designing the interface
to func().
The natural aggregations in Transcript are words, items, lines and
arrays. I build up my own, but those are what folks would expect, so
unless your aggregate is opaque, you might want to use these if you
can.
Words and items build nicely:
func( var1, (v1 && v2 && "ffsdg" && 4.52) )
func( var1, (v1, v2, "ffsdg", 4.52) )
Or, using Andre's list for lines:
func( var1, list(v1, v2, "ffsdg", 4.52)
Or your custom aggregation:
func( var1, rz(v1, v2, "ffsdg", 4.52) )
However, you can always expand the function so that if there are extra
parameters (or the first doesn't look like your aggregate), then the
building is automatic:
func( var1, v1, v2, "ffsdg", 4.52)
In this case, use paramCount() and param() to pick up args 2 up and
build something.
Even for words and items you still might want to use a function because
numberFormat is applied in the creation of words, items and (as it
stands) lines in the above examples. For example, Andre's list example
can be enhanced to include a big numberFormat or other formatting so
info is not lost for numbers. Number info is not lost in array
elements.
Dar
--
**********************************************
DSC (Dar Scott Consulting & Dar's Lab)
http://www.swcp.com/dsc/
A sponsor of RevCon West '05
**********************************************
More information about the use-livecode
mailing list