View Full Version : Shooting Elephants
01-01-1995, 02:00 AM
Found on a news group: A group of programmers, each with different language skills, was given the job of writing a program to Shoot Elephants. RESULTS Pascal pgm got a compile error; #include .... elephant.h not found. "C" pgm compiled but had run time error; ARRAY pointer, out of array bounds, negative, or points to memory in another machine. After 6 months of design effort, the COBOL programmer was in the middle of a nested, IF this-is-an-elephant then IF gun-is-loaded then perform aim-gun-at-elephant thru pull-trigger else goto get-more-ammo ...... --rest of code missing; elephant charged and trampled programmer. RPG program not possible; e-l-e-p-h-a-n-t longer than six bytes. REXX version: Shoot(elephant,dead)
02-16-2000, 08:03 AM
The RPGIII version could look like this one. Better viewed in an attached .txt file. C LOAD BULLET GUN 25 C* C *IN25 DOWEQ*OFF 25: No more bullets C* C SHOOTGUN ELEPHN 26 C *IN26 IFEQ *OFF Missed C LEAVE C ENDIF C* C LOAD BULLET GUN 25 C C ENDDO
02-16-2000, 09:27 AM
The RPG programmer wrote the program in 1 line by defining the elephant gun as a primary file. Unfortunately, an elephant gun doesn't return EOF, so the gun is still firing. Barbara Morris
02-16-2000, 10:04 AM
Barbara, Thanks for your input. Hey, this is an RPG Open Source code, anyone is invited to improve it :) You know those arguments against gun control like - "the gun does not shoot itself....." The SHOOT opcode means that someone have to pull the trigger.
02-16-2000, 11:02 AM
It would be GUN LOAD BULLET in RPG; Remember everything is backwards; This helps improve your memory as you are writing the stuff.
02-19-2000, 07:29 PM
Thanks for the good chuckle, you folks!
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.