How to resolve the algorithm Kernighans large earthquake problem step by step in the Klingphix programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Kernighans large earthquake problem step by step in the Klingphix programming language

Table of Contents

Problem Statement

Brian Kernighan, in a lecture at the University of Nottingham, described a problem on which this task is based. You are given a a data file of thousands of lines; each of three whitespace separated fields: a date, a one word name and the magnitude of the event. Example lines from the file would be lines like:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Kernighans large earthquake problem step by step in the Klingphix programming language

Source code in the klingphix programming language

arg pop nip len dup

( [get nip]
  [drop drop "data.txt"]
) if

%f 
dup "r" fopen !f
$f 0 < ( [drop "Could not open '" print print "' for reading" print -1 end ] [drop] ) if

[dup split 3 get tonum 6 > ( [drop print nl] [drop drop] ) if]
[$f fgets dup -1 #] 
while

drop
$f fclose

"End " input

  

You may also check:How to resolve the algorithm Undefined values step by step in the Prolog programming language
You may also check:How to resolve the algorithm Guess the number/With feedback step by step in the Vala programming language
You may also check:How to resolve the algorithm Averages/Mean time of day step by step in the Icon and Unicon programming language
You may also check:How to resolve the algorithm Literals/Integer step by step in the Dyalect programming language
You may also check:How to resolve the algorithm Percolation/Mean run density step by step in the REXX programming language