www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - requesting a few pointers

reply a.c.edwards <a.c.edwards_member pathlink.com> writes:
Gentlemen,
By share luck and a whole lot of trial and error, I've hacked a small utility
program to reconcile a few reports. It's not very effective but it gets the job
done. I'm wondering if you could look at it and tell me where I've gone wrong
and if possible how I could do things better.
Thanks in advance,
Andrew

-----code-----










































































rjustify(toString(dl), 3) ~ "\r\n");





rjustify(toString(dl), 3) ~ "\r\n");



























































Oct 06 2005
next sibling parent reply Chris Sauls <ibisbasenji gmail.com> writes:
a.c.edwards wrote:
 Gentlemen,
 By share luck and a whole lot of trial and error, I've hacked a small utility
 program to reconcile a few reports. It's not very effective but it gets the job
 done. I'm wondering if you could look at it and tell me where I've gone wrong
 and if possible how I could do things better.
 Thanks in advance,
 Andrew
One thing that immediately comes to mind. You can replace this:

With this: Which already defines a D-linkage system() wrap.


You can get rid of the if(exists()) in this statement, because you've defined your own custom remove() overload earlier that inserts the if(exists()) expression itself. One other thing that's immediate, is that I'm curious as to why you import std.stream and then never use it, at least not that I noticed? -- Chris Sauls
Oct 10 2005
parent a.c.edwards <a.c.edwards_member pathlink.com> writes:
In article <dieg7j$m8j$1 digitaldaemon.com>, Chris Sauls says...
a.c.edwards wrote:
 Gentlemen,
 By share luck and a whole lot of trial and error, I've hacked a small utility
 program to reconcile a few reports. It's not very effective but it gets the job
 done. I'm wondering if you could look at it and tell me where I've gone wrong
 and if possible how I could do things better.
 Thanks in advance,
 Andrew
One thing that immediately comes to mind. You can replace this:

With this:
Thanks, I didn't realize that it was already wrapped in std.process. I've made the change.
Which already defines a D-linkage system() wrap.



You can get rid of the if(exists()) in this statement, because you've defined your own custom remove() overload earlier that inserts the if(exists()) expression itself.
Got it. I through that function in after I realized I was using that statement alot.
One other thing that's immediate, is that I'm curious as to why you import
std.stream and 
then never use it, at least not that I noticed?
I was trying to imporove the program and realized it was a whole lot faster to write to a file stream than to continuously append to the file. I will be using it shortly. Thanks for your time.
-- Chris Sauls
Oct 15 2005
prev sibling parent reply BCS <BCS_member pathlink.com> writes:

Oct 10 2005
parent a.c.edwards <a.c.edwards_member pathlink.com> writes:
In article <dif09n$4dq$1 digitaldaemon.com>, BCS says...

Point taken. I guess that is one of the problems all neophytes face. I will get better, I'm sure, but I was looking for something to speed up a process and comments were the last thing on my mind. Thanks, Andrew
Oct 15 2005