Re: COBOL compiler

From: Colin Watson (cjwatson_at_debian.org)
Date: 08/30/03

  • Next message: Colin Watson: "Re: kmail, testing"
    Date: Sat, 30 Aug 2003 01:37:59 +0100
    To: Debian-User <debian-user@lists.debian.org>
    
    

    On Fri, Aug 29, 2003 at 05:46:01PM -0500, Ron Johnson wrote:
    > On Fri, 2003-08-29 at 16:28, Bijan Soleymani wrote:
    > > Well then you do it differently:
    > > open(INPUT,"records.txt");
    > > LOOP: while($record = <INPUT>)
    > > {
    > > if(!input_filter($record))
    > > {
    > > next LOOP;
    > > }
    > > else
    > > {
    > > #code to process record
    > > }
    > > }
    > > close(INPUT);
    > >
    > > Where input_filter() is the winnowing function you define.
    >
    > That's good, but where's the sort function? Also, what if each
    > record-to-be-sorted doesn't come directly from records.txt? Maybe,
    > for each record read from records.txt, you must also query some
    > other file(s), or a database, or must do some other algorithmic
    > calculation.

    RTFM: 'perldoc -f sort'. None of this is terribly hard in Perl at all; I
    don't see the point of making people write pseudocode to prove the
    point.

    > The COBOL SORT verb has 3 sections:
    > INPUT - Records (from whatever input) are RELEASEd to the SORT buffers.
    > Any winnowing or transformations can happen here.
    > SORT - You can figure that part out.
    > OUTPUT - Records are RETURNed from the actual sort and can be pro-
    > cessed (transformed, summarized, etc).

    Sounds like the 'map sort map' idiom in Perl that's often used for
    complex cases. (It's also a common optimization to factor out expensive
    transformations in the sort comparator.)

    Cheers,

    -- 
    Colin Watson                                  [cjwatson@flatline.org.uk]
    -- 
    To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
    with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
    

  • Next message: Colin Watson: "Re: kmail, testing"

    Relevant Pages