Kernighans large earthquake problem: Difference between revisions
Kernighans large earthquake problem (view source)
Revision as of 14:55, 30 January 2021
, 3 years agoAdd SNOBOL
Not a robot (talk | contribs) (Add 8080 assembly) |
Not a robot (talk | contribs) (Add SNOBOL) |
||
Line 1,372:
.map(_.mkString("\t"))
.foreach(println)</lang>
=={{header|Snobol}}==
This is hard-coded to read the input from "data.txt".
<lang snobol> input(.quake, 1,, 'data.txt') :f(err)
num = '.0123456789'
line test = quake :f(end)
test span(num) . magnitude rpos(0) :f(line)
output = gt(magnitude,6) test :(line)
err output = 'Error!'
end</lang>
{{output}}
<pre>$ cat data.txt
8/27/1883 Krakatoa 8.8
5/18/1980 MountStHelens 7.6
3/13/2009 CostaRica 5.1
1/23/4567 EdgeCase1 6
1/24/4567 EdgeCase2 6.0
1/25/4567 EdgeCase3 6.1
$ snobol4 quakes.sno
8/27/1883 Krakatoa 8.8
5/18/1980 MountStHelens 7.6
1/25/4567 EdgeCase3 6.1</pre>
=={{header|Swift}}==
|