Re: Associative array

new topic     » goto parent     » topic index » view thread      » older message » newer message

Yes Pete the differents is what is meaned by insert ? A insert before or insert after a given position . PEU has taken the definition , as far as I remember , from Bach's implementetion . This used a insert after .

function insertA(sequence org, sequence what, integer where)  
if where then  
return org[1..where]&{what}&org[where+1..length(org)] 
else 
return {what}&org[where+1..length(org)] 
end if 
end function                 
 
function insertB(sequence org, sequence what, integer where)  
return org[1..where-1]&{what}&org[where..length(org)] 
end function                 
? insertA({1,2,4},{3},0) 
 
? insertB({1,2,4},{3},1) 
 
? insertA({1,2,4},{3},3) 
 
? insertB({1,2,4},{3},3) 

I have to think about why or what is beter .

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu