Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

I'm a bit stuck...

 [1/3] from: balayo::mindspring::com at: 26-Jul-2001 9:18


Howdy guys, I'm stuck, actually, on two points. I can make a file filled with: [9-Sep-2001 "here" $70.00] [10-Oct-2001 "there" $55.89] [5-Nov-2001 "deposit" $100.00] I want to subtract from a beginning balance (I ask for that first) unless the "deposit" string is found, then I want to add to it. should I make the file: rebol [] stuff: [ [9-Sep-2001 "here" $70.00] [10-Oct-2001 "there" $55.89] [5-Nov-2001 "deposit" $100.00] ] umm, something with pick, and parse...? =) Thanks -- -tom

 [2/3] from: micael:gullmes:telenordia:se at: 26-Jul-2001 15:36


Here is one way of doing it, balance: $2000 stuff: [ 9-Sep-2001 "here" $70.00 10-Oct-2001 "there" $55.89 5-Nov-2001 "deposit" $100.00 ] foreach [date reason expense] stuff [ either equal? reason "deposit" [ balance: balance + expense ][ balance: balance - expense ] print rejoin ["On " date " the balance was: " balance] ] Brgd /Micael -----Ursprungligt meddelande----- Fran: Tom Foster [mailto:[balayo--mindspring--com]] Skickat: den 26 juli 2001 15:18 Till: REBOL List Amne: [REBOL] I'm a bit stuck... Howdy guys, I'm stuck, actually, on two points. I can make a file filled with: [9-Sep-2001 "here" $70.00] [10-Oct-2001 "there" $55.89] [5-Nov-2001 "deposit" $100.00] I want to subtract from a beginning balance (I ask for that first) unless the "deposit" string is found, then I want to add to it. should I make the file: rebol [] stuff: [ [9-Sep-2001 "here" $70.00] [10-Oct-2001 "there" $55.89] [5-Nov-2001 "deposit" $100.00] ] umm, something with pick, and parse...? =) Thanks -- -tom

 [3/3] from: jelinem1:nationwide at: 26-Jul-2001 9:08


Your task looks much like a piece of an accounting, or checkbook program. I've written 3 iterations of a checkbook program now, and have yet to complete a version in /View. I really need to find the time to complete it. You are storing your data in 'mold format? I'm not challenging the decision, but (largely for historical reasons) I chose a different storage format: fixed-length fields with no other syntax. This facilitates easy list display when reading in the file as a block of lines in a fixed-width font, and makes the records just as easy to sort (no compare function needed). When I need to display the fields of a single check (in the edit pane) or perform computations I parse the line into a structure. You may have different labels meaning "add to balance", for this reason I suggest the following: ; Assume that you've already got the beginning balance foreach record stuff [ balance: either found? find ["deposit"] pick record 2 [ balance - pick record 3 ][ balance + pick record 3 ] ] print balance - Michael Jelinek From: Tom Foster <[balayo--mindspring--com]>@www.mindspring.com on 07/26/2001 08:18 AM Please respond to [rebol-list--rebol--com] Sent by: tom <[tf--www--mindspring--com]> To: REBOL List <[rebol-list--rebol--com]> cc: Subject: [REBOL] I'm a bit stuck... Howdy guys, I'm stuck, actually, on two points. I can make a file filled with: [9-Sep-2001 "here" $70.00] [10-Oct-2001 "there" $55.89] [5-Nov-2001 "deposit" $100.00] I want to subtract from a beginning balance (I ask for that first) unless the "deposit" string is found, then I want to add to it. should I make the file: rebol [] stuff: [ [9-Sep-2001 "here" $70.00] [10-Oct-2001 "there" $55.89] [5-Nov-2001 "deposit" $100.00] ] umm, something with pick, and parse...? =) Thanks -- -tom