Re: Generic symbolic sequence assignment
- Posted by Fernando Nov 19, 2011
- 1358 views
DerekParnell said...
Fernando said...
Probably, in this specific case. However, the LHS generic symbolic sequence shows its usefulness when the RHS is a function that returns a generic sequence.
Yes, I was thinking of that, but I'm not yet sure of practical that might be.
Here is an obviously contrived example, but it does highlight problems with functions that return different structures based on the input data.
function FUNC(object x) if x > 0 then return {x, {x * x, sqrt(x)}} elsif x = 0 then return x else return {-x, x * x} end if end function {a,{b,c}} = FUNC( userdata )
Yes. The generic symbolic sequence assignment is, basically, practical only when the structure of the returned object is constant and compatible with the structure of LHS symbolic sequence. But I think there are many cases in this situation.
- Fernando