I'm working on modernizing Rosetta Code's infrastructure. Starting with communications. Please accept this time-limited open invite to RC's Slack.. --Michael Mol (talk) 20:59, 30 May 2020 (UTC)


From Rosetta Code
Some languages I know
Language Proficiency
BASIC uh...
C Faded
ColdFusion Experienced'
DCL Faded
JavaScript Faded
MUMPS Experienced
SQL Moderate

Shooting Yourself in the Foot[edit]

You shoot 583149 AK-47 Teflon-tipped, hollow-point, armor-piercing bullets into even-numbered toes on odd-numbered feet of everyone in the building -- with one line of code. Three weeks later you shoot yourself in the head rather than try to modify that line.

Iterative version[edit]

You'll have to implement the ^Shoot routine on your own. I'm assuming the count is right rather than checking it, and dispensing only 1 bullet per toe.

S ^W("AK-47","AMMO")="Teflon-tipped,hollow-point,armor-piercing" F P=$O(^B("")):0:($D(^B(P))#10) F F=$O(^B(P,"")):0:'$D(^B(P,F))#10 F T=$O(^B(P,F,"")):0:('$D(^B(P,F,T))#10) S:('F#2)&(T#2) X=$$SHOOT(^W("AK-47"),^B(P,F,T),1) S P=$O(^B(P)) Q  S F=$O(^B(P,F)) Q  S T=$O(^B(P,F,T)) Q