Re: I hope there's a more efficient way of doing this

new topic     » goto parent     » topic index » view thread      » older message » newer message
axtens said...

Now comes the ugliest bit of Euphoria I think I've ever had the cause to generate (I can send you the VBScript that did it if you like). My question is (in expectation that you're not going to scroll down to the end) is this: Is there any better way of doing NumToBlock? I'm fairly sure there's no 'case' statement in Euphoria, but things have changed a fair bit since v1.5 (when I first encountered the language), so there may well be a solution standing right under my nose.

There will be a switch/case construct in 4.0, but in this case, I don't think it would be any prettier. What you could do is store the information like:

 { 
  { start_range, end_range, code_page }, 
  { start_range, end_range, code_page } 
  ... 
 } 

Then you search for the appropriate code page in a loop. If it's sorted, you could do a binary search, or just order them by expected frequency.

Matt

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

Search



Quick Links

User menu

Not signed in.

Misc Menu