Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

chaoticset (2105)

chaoticset
  (email not shown publicly)
http://chaoticset.perlmonk.org/
AOL IM: chaoticset23 (Add Buddy, Send Message)
Yahoo! ID: illuminatus_foil (Add User, Send Message)

JAPH. (That's right -- I'm not Really Inexperienced any more.)

I'm not just here, I'm here [perlmonks.org], and here [javajunkies.org] too, I ramble randomly in my philosophical blog [blogspot.com] and my other blog [blogspot.com]. Soon I'll come in a convenient six-pack.

Journal of chaoticset (2105)

Wednesday October 03, 2001
11:08 PM

Hindsight

[ #872 ]
Well, a bunch of Dew, a lot of Chinese food, and several hours later, my test is done, and now I'm ready for the fun part.

I need to design this stupid data system.

I swear to Order I must be a damn nitwit. For all the design stuff I keep reading, it just never lands in my mind until it's too late: DESIGN FIRST, GOD DAMMIT.

And let that be a lesson to...me.

Well, the basics are fairly easy. Build a function that drops the whole file into an array, then build one that drops the whole *new* file into another one. (See, I'm going to dump the whole line, name:stock:shown, into one single array value. That's so I don't have to figure out how to work multidimensionals properly. Okay, so it's not the right kind of lazy. I still think it'll speed things up significantly.)

Once there's two arrays, it's going to check the new stuff's first entry (because it assumes these are at least *roughly* alphabetic) and spin the other array until the two closest matches are at each end, the one before at the bottom and the one after at the top.

THEN it grabs the new one (because this is the spot it should go into the full inventory) and pushes it onto that array at the bottom.

Repeat, rinse, condition, you get the idea.

Well, I do, mostly. And it'll result in those elements being sorted. Assuming you've started with two sorted arrays, this should be quick.

I'm going to kick back with my whiteboard and work out the code details, and I'll come back once I've gotten to the compiling stage. Should be tomorrow.

And perhaps, from now on, I'll remember what I'm supposed to do first.
CHEESE!
God Damn, no! Not cheese!
DESIGN!
Yes, yes, design.

Sometimes I feel like a trained ape, honestly.