[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

The Seasoned COBOLer





> It's a scary concept to think of Cobol programs running around
> tearing modern program apart using its mighty features like MOVE
> CORRESPONDING.

In a world similar to yet subtly
different from our own, where CS
students express the naturals as:

|       01 Nat
|         88 zero VALUE 0
|         88 succ VALUE S(Nat)

they might also write:

|       2000-Factorial
|               READ n
|		DO iota
|               INSPECT ns REPLACING    Nil        BY 1
|                                       Cons(x,xs) BY (*)(x,xs)
|               DISPLAY REDUCED result
|       END

leading to _The Little COBOLer_'s:

|       3000-Member?
|               READ atom, lat
|               INSPECT lat REPLACING   Nil        BY False
|                                       Cons(x,xs) BY Or(Eq?(atom,x),xs)
|               DISPLAY REDUCED result
|       END

or its alternative:

|       3005-Member?'
|               READ atom, lat
|               SET flag TO false
|               INSPECT lat TALLYING flag FOR FIRST atom
|               DISPLAY flag
|       END
        
and leading up to such mighty features
as BEFORE-FINAL-WHEN-DELIMITED:

|       4000-Rember-up-to-last
|               READ atom, lat
|               INSPECT lat ELIDING LEADING Cons(_,_)
|                       BEFORE FINAL atom WHEN DELIMITED
|               DISPLAY lat
|       END

-Dave