comp.lang.ada
 help / color / mirror / Atom feed
From: xdragon@ames.net (Brad Dale)
Subject: Re: 'Money wanted' algorithm (Cobol version)
Date: 1996/12/31
Date: 1996-12-31T00:00:00+00:00	[thread overview]
Message-ID: <32c8845d.205199674@news.ames.net> (raw)
In-Reply-To: 5a8h44$elt@news.inetdirect.net


On Mon, 30 Dec 96 13:54:10 GMT, spam.free.zone@no-spam.com (Doug
Miller) wrote:


>>>DC> Step 1 Find empty coffee cup
>>>DC> Step 2 Find busy Street
>>>DC> Step 3 Sit in middle of Street
>>>DC> Step 4 goto Step 3 until sun goes down.
>>>DC> Stpe 5 goto step 1 in the next day.
>>
>>>Tsk, tsk, bad advice. Goto's are evil!
>>
>>>Program Make_Money;
>>
>>>Uses
>>>  Nothing;
>>
>>>begin
>>>  Repeat
>>>    Find(EmptyCoffeeCup);
>>>    Find(BusyStreet);
>>>    Repeat
>>>      Sit(MiddleOfStreet)
>>>    Until Sun(Down)
>>>  Until Hell(FrozenOver)
>>>end.
>>
>>>See mom, I DO have the Christmas spirit!
>>
>>>   Dennis!
>>Hey that's cool can you do it in Cobol?
>>
>Sure thing:
>
>PERFORM WITH TEST AFTER UNTIL hell-frozen-over
>    PERFORM find-empty-coffee-cup
>    PERFORM find-busy-street
>    PERFORM sit-middle-of-street UNTIL sunset
>    PERFORM wait-til-morning
>END-PERFORM
>   

(define get_money
   (lambda (status amount_money)
       (if ((!= status HELLFROZEN) amount_money)
           (+ amount_money  
               (coffee status amount_money))))))

(define coffee
   (lambda (status amount_money)
       (begin
          (1 COFFECAN)
          (find_street status amount_money))))

(define find_street
   (lambda (status amount_money)
     (begin
        (1 STREET)
        (sit_street 0 status amount_money))))

(define sit_street
   (lambda (time status amount_money)
      (if ((= time SUNSET) amount_money)
          (+ (+ amount_money PROFIT) 
              (sit_street (+ 1 time) status amount_money)))))


Written sorta in SCHEME, been awhile so don't be to hard on it
			firehawk@ames.net





  parent reply	other threads:[~1996-12-31  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-12-30  0:00 'Money wanted' algorithm (Cobol version) Doug Miller
1996-12-30  0:00 ` Renegade
1996-12-30  0:00   ` 'Money wanted' algorithm (Lisp version) Ken Tilton
1996-12-30  0:00   ` 'Money wanted' algorithm (Cobol version) Bill Haverberg
1996-12-31  0:00   ` Bob Jarvis
1996-12-31  0:00     ` Deric Cheng
1996-12-30  0:00 ` Beldraen
1996-12-31  0:00   ` Constantinos A. Kotsokalis
1996-12-30  0:00 ` Sundial Services
1996-12-31  0:00 ` Brad Dale [this message]
     [not found]   ` <32C988BA.427D@dynasty.net>
1997-01-01  0:00     ` Pae Choi
1996-12-31  0:00 ` Robin Becker
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox