Re: [tutorial] Basic Sequence Operations

new topic     » goto parent     » topic index » view thread      » older message » newer message
? insert(s,99,8) 
-- {1,2,3,99} 

Note that this, too is semantically puzzling. Any number larger than the length of the sequence just appends, resulting in a sequence of length 4. It doesn't expand the sequence to the required length, and then set s[8] = 99, as one might expect. But that would bring up another problem: what values are to be used to fill in s[4..7]?

The alternative would be to have errors - something like s[0] doesn't exist! and can't insert past end of sequence! Those would be easy to add.

The real question being "is this a problem worth fixing?"

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

Search



Quick Links

User menu

Not signed in.

Misc Menu