Re: subscripts (Long Post)
- Posted by Jiri Babor <J.Babor at GNS.CRI.NZ> May 17, 2000
- 455 views
Lewis, Since you are unlikely to draw real blood from that particular stone, try the folowing function, if you have to do it your way: function fetch(object a, sequence b) integer i,len i = 1 len = length(b) while i <= len do a = a[b[i]] i += 1 end while return a end function Or, if you prefer a recursive variant: function rfetch(object a, sequence b) integer len len = length(b) if len>1 then return rfetch(a[b[1]],b[2..length(b)]) else return a[b[1]] end if end function Btw, I have a strong feeling, the recursive beast can be improved, but because the first function is always going to be slightly faster anyway, I do not worry too much about it. jiri