Author Topic: Convert coordinate files to x,y  (Read 555 times)

0 Members and 1 Guest are viewing this topic.

kdub

  • SuperMod
  • Swamp Rat
  • Posts: 947
  • class keyThumper<T>:ILazy<T>
Re: Convert coordinate files to x,y
« Reply #30 on: September 02, 2017, 02:01:09 am »
While that is generally good advice, and Michaels comments regarding data formatting ;
I can understand the desire to be able to handle various formatting structures.

Having one function to parse the data file irrespective of it's structure is definitely an advantage if we are dealing with data from various sources.

I hadn't imagined the format would be as mixed in ONE file as the example I posted but being able to process ANY of the formats would be handy.

Good generic solution Fools.
called Kerry in my other life

Sometimes the question is more important than the answer.

fools

  • Newt
  • Posts: 52
  • China
Re: Convert coordinate files to x,y
« Reply #31 on: September 02, 2017, 05:05:22 am »
While that is generally good advice, and Michaels comments regarding data formatting ;
I can understand the desire to be able to handle various formatting structures.

Having one function to parse the data file irrespective of it's structure is definitely an advantage if we are dealing with data from various sources.

I hadn't imagined the format would be as mixed in ONE file as the example I posted but being able to process ANY of the formats would be handy.

Good generic solution Fools.

Thanks.
I tested Lee, MP and my code by benchmark.lsp.
Before testing, I added some content to MP's code. Let three functions has same result.
MP's function is the fastest and mine is the slowest. So, MP's function is recommended, especially when the amount of data is large.
BTW, Lee use regular expression is very wise solution.
Good good study , day day up . Sorry about my Chinglish .

MP

  • Seagull
  • Posts: 16985
  • brevity != aggression
Re: Convert coordinate files to x,y
« Reply #32 on: September 04, 2017, 02:17:14 pm »
Thanks for the nod fools. That said, I wouldn't necessarily consider my normalize function as recommended. It was more of an acedemic response to a contrived challenge that doesn't tend to exist much in real life. That is, data is normally consistant (tho it may be ugly). Be it spawned from a spreadsheet, a database, a data collector ... whatever. As such -- and especially if you're concerned with performance -- tailored code will perform far better than my "try to do it all" function. Cheers.
\|// Set goal. Experiment tirelessly until
|oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox | About