Halt and catch fire: Difference between revisions

Added Easylang
(Added a shorter solution.)
(Added Easylang)
 
(9 intermediate revisions by 5 users not shown)
Line 101:
</pre>
 
=={{header|CBinary Lambda Calculus}}==
BLC forces normal programs to start with a closed lambda term, by mapping free variables to the divergent Omega = <code>(\x.x x)(\x.x x)</code>, the lambda calculus equivalent of an infinite loop. That makes the following 2-bit BLC program the smallest to catch fire:
<syntaxhighlight lang="c">int main(){int a=0, b=0, c=a/b;}</syntaxhighlight>
 
<pre>10</pre>
 
=={{header|BQN}}==
Line 110 ⟶ 112:
 
Other runtime errors are possible, but not as easy to use.
 
=={{header|Bruijn}}==
Bruijn does not have runtime errors. For debugging you can either write tests (which are run before evaluating main) or use tactical infinite loops:
<syntaxhighlight lang="bruijn">
:test ([[0]]) ([[1]])
 
main [[0 0] [0 0]]
</syntaxhighlight>
 
=={{header|C}}==
<syntaxhighlight lang="c">int main(){int a=0, b=0, c=a/b;}</syntaxhighlight>
 
=={{header|C++}}==
Line 155 ⟶ 168:
<pre>
 
</pre>
 
=={{header|EasyLang}}==
<syntaxhighlight>
a[] = [ ]
print a[1]
</syntaxhighlight>
{{out}}
<pre>
*** ERROR: index out of bounds
</pre>
 
Line 288 ⟶ 311:
 
It's probably more effective to use <syntaxhighlight lang="j"> exit 0</syntaxhighlight> -- this approach would eliminate dependence on a variety of implementation details.
 
=={{header|Java}}==
<syntaxhighlight lang="java">
public final class HaltAndCatchFire {
 
public static void main(String[] aArgs) {
// Any one of the lines below, when uncommented, will cause a program halt.
// throw new AssertionError("Stop now!");
// System.out.println(0/0);
// Runtime.getRuntime().exit(1);
}
 
}
</syntaxhighlight>
 
=={{header|jq}}==
Line 596 ⟶ 634:
 
=={{header|Wren}}==
<syntaxhighlight lang="ecmascriptwren">Fiber.abort("")</syntaxhighlight>
 
=={{header|XBS}}==
2,041

edits