Text processing/Max licenses in use: Difference between revisions

m
Reverted edits by Cloudius (talk) to last revision by Gpapo
(Scala contribution added.)
m (Reverted edits by Cloudius (talk) to last revision by Gpapo)
Line 1:
{{task|Text processing}}
 
A company currently pays a fixed sum for the use of a particular licensed software package.   In determining if it has a good deal it decides to calculate its maximum use of the software from its license management log file.
 
Assume the software's licensing daemon faithfully records a checkout event when a copy of the software starts and a checkin event when the software finishes to its log file.
Line 12:
 
;Task:
Save the 10,000 line log file from &nbsp; [http://rosettacode.org/resources/mlijobs.txt <big> here</big>] &nbsp; into a local file, then write a program to scan the file extracting both the maximum licenses that were out at any time, and the time(s) at which this occurs.
 
Mirror of log file available as a zip [https://github.com/thundergnat/rc/blob/master/resouces/mlijobs.zip here] (offsite mirror).
<br><br>
 
=={{header|Ada}}==
<lang Ada>-- licenselist.adb --
Line 88 ⟶ 89:
end licenselist;</lang>
Output:
<pre>
The max. number of licenses out is 99
The max. number of licenses out is 99
at these times
2008/10/03_08:39:34
2008/10/03_08:40:40
[2010-06-06 01:06:07] process terminated successfully (elapsed time: 00.25s)
</pre>
 
=={{header|ALGOL 68}}==
{{trans|C}} note: This specimen retains the original [http://rosettacode.org/mw/index.php?title=Text_processing%2F3&diff=87014&oldid=87011 C] coding style.
Line 172 ⟶ 174:
)</lang>
Output:
<pre>
Maximum simultaneous license use is 99 at the following times:
Maximum simultaneous license use is 99 at the following times:
2008/10/03_08:39:34
2008/10/03_08:4039:4034
2008/10/03_08:40:40
</pre>
 
=={{header|APL}}==
Line 184 ⟶ 188:
mx ← (⎕IO+⍳⍴lu)/⍨lu= max ← ⌈/ lu
⎕ ← 'Maximum simultaneous license use is ' , ' at the following times:' ,⍨ ⍕max ⋄ ⎕←D[mx;]</lang>
<lang apl>Maximum simultaneous license use is 99 at the following times:
2008/10/03_08:39:34
2008/10/03_08:40:40</lang>
 
=={{Header|AutoHotkey}}==
{{trans|Python}}
<lang autohotkey>IfNotExist, mlijobs.txt
IfNotExist, mlijobs.txt
UrlDownloadToFile, http://rosettacode.org/mlijobs.txt, mlijobs.txt
 
Line 210 ⟶ 215:
}
 
MsgBox Maximum use is %max_out% at:`n`n%max_times%</lang>
</lang>
Maximum use is 99 at:
<pre>
Maximum use is 99 at:
 
2008/10/03_08:39:34
2008/10/03_08:40:40
</pre>
 
=={{header|AWK}}==
Line 234 ⟶ 242:
 
'''Sample output'''
<pre>The biggest number of licenses is 99 at 2008/10/03_08:39:34 and 2008/10/03_08:40:40 !</pre>
 
On a 2.53MHz machine, these timings were obtained using GNU Awk 4.0.2:
Line 270 ⟶ 278:
END</lang>
'''Output:'''
<pre>
Maximum licences checked out = 99
Maximum licences checked out = 99
From 2008/10/03_08:39:34 to 2008/10/03_08:40:40
From 2008/10/03_08:39:34 to 2008/10/03_08:40:40
</pre>
 
=={{header|Bracmat}}==
 
<lang bracmat>( 0:?N:?n
& :?Ts
Line 292 ⟶ 303:
)
| out$(!N !Ts)
);</lang>
</lang>
Output:
<pre>99 2008/10/03_08:39:34 2008/10/03_08:40:40</pre>
 
=={{header|C}}==
 
<lang c>#include <stdio.h>
#include <stdlib.h>
Line 397 ⟶ 410:
munmap(buf, s.st_size);
return close(fd);
}</lang>output<lang>2008/10/03_08:39:34 99
2008/10/03_08:3940:3440 99</lang>
2008/10/03_08:40:40 99
 
=={{header|C++}}==
Line 458 ⟶ 470:
 
=={{header|C sharp|C#}}==
<lang csharp>using System;
using System;
using System.Collections.Generic;
using System.Linq;
Line 503 ⟶ 516:
}
}
}
}</lang>
</lang>
99
<pre>
2008/10/03_08:39:34
99
2008/10/03_08:40:40
2008/10/03_08:39:34
2008/10/03_08:40:40
</pre>
 
=={{header|Clojure}}==
 
<lang clojure>(defn delta [entry]
(case (second (re-find #"\ (.*)\ @" entry))
Line 526 ⟶ 543:
(map println times))</lang>
 
<pre>
Maximum simultaneous license use is 99 at the following times:
Maximum simultaneous license use is 99 at the following times:
2008/10/03_08:39:34
2008/10/03_08:4039:4034
2008/10/03_08:40:40
</pre>
 
=={{header|COBOL}}==
Line 624 ⟶ 643:
 
=={{header|Common Lisp}}==
 
{{libheader|CL-PPCRE}}
 
<lang lisp>(defun max-licenses (&optional (logfile "mlijobs.txt"))
(with-open-file (log logfile :direction :input)
Line 644 ⟶ 665:
(push time max-log-times)))))))</lang>
 
<pre>> (max-licenses)
Maximum simultaneous license use is 99 at the following times:
2008/10/03_08:39:34
2008/10/03_08:40:40.
NIL</pre>
 
=={{header|D}}==
<lang d>void main() {
Line 669 ⟶ 691:
}</lang>
{{out}}
<pre>Maximum simultaneous license use is 99 at the following times:
"2008/10/03_08:39:34"
"2008/10/03_08:40:40"</pre>
 
=={{header|E}}==
 
{{trans|Python}}
 
<lang e>var out := 0
var maxOut := 0
Line 699 ⟶ 723:
}</lang>
=={{header|Eiffel}}==
<lang Eiffel>class
class
APPLICATION
 
Line 751 ⟶ 776:
data: LIST [STRING]
 
end</lang>
</lang>
{{out}}
<pre>
Max Licences OUT: 99
Max Licences OUT: 99
Date: 2008/10/03_08:39:34
Date: 2008/10/03_08:39:34
</pre>
 
=={{header|Erlang}}==
<lang Erlang>-module( text_processing_max_licenses ).
-module( text_processing_max_licenses ).
 
-export( [out_dates_from_file/1, task/0] ).
Line 784 ⟶ 813:
 
out_dates_n( N, <<"OUT">> ) -> N + 1;
out_dates_n( N, <<"IN">> ) -> N - 1.</lang>
</lang>
{{out}}
<pre>
12> text_processing_max_licenses:task().
12> text_processing_max_licenses:task().
Max licenses was 99 at [<<"2008/10/03_08:39:34">>,<<"2008/10/03_08:40:40">>]
Max licenses was 99 at [<<"2008/10/03_08:39:34">>,<<"2008/10/03_08:40:40">>]
</pre>
 
=={{header|Euphoria}}==
Line 845 ⟶ 877:
printf(1, "%s\n", {maxtime[i]})
end for</lang>
 
Output:
<pre>Maximum simultaneous license use is 99 at the following times:
2008/10/03_08:39:34
2008/10/03_08:40:40
</pre>
 
=={{header|Factor}}==
Placing the file in resource:work/mlijobs.txt:
 
<lang factor>USING: kernel sequences splitting math accessors io.encodings.ascii
io.files math.parser io ;
Line 911 ⟶ 946:
 
=={{header|Forth}}==
<lang forth>20 constant date-size
20 constant date-size
create max-dates date-size 100 * allot
variable max-out
Line 943 ⟶ 979:
max-dates count type cr ;
 
main bye</lang>
</lang>
 
== {{header|Fortran}} ==
{{Works with|Fortran|90 and later}}
 
<lang fortran> PROGRAM MAX_LICENSES
PROGRAM MAX_LICENSES
IMPLICIT NONE
Line 984 ⟶ 1,022:
WRITE(*,"(A)") maxtime(1:maxcount)
END PROGRAM MAX_LICENSES</lang>
</lang>
Output
<pre>
Maximum simultaneous license use is 99 at the following times:
2008/10/03_08:39:34
2008/10/03_08:40:40
</pre>
 
=={{header|Gema}}==
Start with ''gema -f licenses.gema mlijobs.txt''
<lang gema>@set{count;0};@set{max;0}
@set{count;0};@set{max;0}
 
License OUT \@ * *\n=@incr{count}@testmax{${count},*}
Line 1,000 ⟶ 1,041:
testmax:*,*=@cmpn{${max};$1;@set{max;$1};;}@append{times${count};$2\n}
 
report:*,*=Maximum simultaneous license use is * at\n*</lang>
</lang>
Output:
<pre>
Maximum simultaneous license use is 99 at
Maximum simultaneous license use is 99 at
2008/10/03_08:39:34
2008/10/03_08:4039:4034
2008/10/03_08:40:40
</pre>
 
=={{header|Go}}==
Line 1,068 ⟶ 1,112:
}</lang>
{{out}}
<pre>
max licenses: 99
max licenses: 99
at:
at:
2008/10/03_08:39:34
2008/10/03_08:40:40
</pre>
 
=={{header|Groovy}}==
Line 1,102 ⟶ 1,148:
 
println "Maximum Licenses $max"
dates.each { date -> println " $date" }</lang>
</lang>
Output:
<pre>
Maximum Licenses 99
Maximum Licenses 99
2008/10/03_08:39:34
2008/10/03_08:40:40
</pre>
 
== {{header|Haskell}} ==
<lang haskell>import Data.List
import Data.List
 
main = do
Line 1,117 ⟶ 1,167:
mo = maximum cio
putStrLn $ "Maximum simultaneous license use is " ++ show mo ++ " at:"
mapM_ (putStrLn . (dt!!)) . elemIndices mo $ cio</lang>
</lang>
 
=={{header|HicEst}}==
{{incorrect|HicEst}}
We open Licenses.txt in [http://www.HicEst.com/MatrixExplorer.htm MatrixExplorer mode] with 3 columns: IN/OUT, date_time, ID_nr.
This allows to adress single file elements by Licenses(row, column).
Line 1,171 ⟶ 1,221:
 
And a run of the program:
<pre>->ml <mlijobs.txt
There were 99 licenses out at:
2008/10/03_08:39:34
2008/10/03_08:40:40
-></pre>
 
 
== {{header|J}} ==
Line 1,185 ⟶ 1,236:
NB. Output results
(mx { D) ,~ 'Maximum simultaneous license use is ' , ' at the following times:' ,~ ": {. ,mx { lu</lang>
<pre>
Maximum simultaneous license use is 99 at the following times:
2008/10/03_08:39:34
2008/10/03_08:40:40
</pre>
 
=={{header|Java}}==
Line 1,221 ⟶ 1,274:
}
}</lang>
<pre>Max licenses out: 99
At time(s): [2008/10/03_08:39:34, 2008/10/03_08:40:40]</pre>
 
=={{header|JavaScript}}==
Line 1,250 ⟶ 1,303:
 
output:
<pre>Max licenses out: 99
2008/10/03_08:39:34
2008/10/03_08:40:40</pre>
=={{header|jq}}==
{{works with|jq|1.4}}
Line 1,291 ⟶ 1,344:
`0:,/"Maximum simultaneous license use is ",$x;
`0:" at the following times:\n";`0:r[;14+!19]</lang>
 
Output:
 
Maximum simultaneous license use is 99 at the following times:
<lang K>Maximum simultaneous license use is 99 at the following times:
2008/10/03_08:39:34
2008/10/03_08:4039:4034
2008/10/03_08:40:40</lang>
 
=={{header|Julia}}==
{{works with|Julia|0.6}}
{{trans|Python}}
 
<lang julia>function maximumsimultlicenses(io::IO)
out, maxout, maxtimes = 0, -1, String[]
Line 1,317 ⟶ 1,373:
println("Maximum simultaneous license use is $maxout at the following times: \n - ", join(maxtimes, "\n - "))
end</lang>
 
{{out}}
<pre>Maximum simultaneous license use is 99 at the following times:
- 2008/10/03_08:39:34
- 2008/10/03_08:40:40</pre>
 
=={{header|Kotlin}}==
Line 1,354 ⟶ 1,411:
println(dates.map { " $it" }.joinToString("\n"))
}</lang>
 
The file used for testing:
<pre>
<pre>License OUT @ 2008/10/03_23:51:05 for job 4974
License OUT @ 2008/10/03_23:51:05 for job 4974
License OUT @ 2008/10/03_23:57:00 for job 4975
License IN @ 2008/10/04_00:00:06 for job 4975
License OUT @ 2008/10/04_00:07:19 for job 4976
License IN @ 2008/10/04_00:11:32 for job 4976
License IN @ 2008/10/04_00:18:22 for job 4974</pre>
</pre>
 
{{out}}
<pre>
Maximum simultaneous license use is 2 at the following time(s):
Maximum simultaneous license use is 2 at the following time(s):
2008/10/03_23:57:00
2008/10/04_00:07:19
</pre>
 
=={{header|Lua}}==
Line 1,398 ⟶ 1,461:
end</lang>
Output:
<pre>Maximum licenses in use: 99
Occurrences:
2008/10/03_08:39:34
2008/10/03_08:40:40</pre>
 
=={{header|M4}}==
<lang M4>divert(-1)
divert(-1)
define(`current',0)
define(`max',0)
Line 1,415 ⟶ 1,479:
divert
max
undivert(1)</lang>
</lang>
 
Output:
<pre>
99
99
@ 2008/10/03_08:39:34 @ 2008/10/03_08:40:40
</pre>
 
=={{header|Mathematica}}==
Line 1,429 ⟶ 1,497:
 
Output:
<pre>-> The maximum number of licenses used was 99, at {2008/10/03_08:39:34,2008/10/03_08:40:40}</pre>
 
=={{header|MAXScript}}==
Line 1,475 ⟶ 1,543:
licencesInUse()</lang>
Output
<pre>Maximum simultaneous license use is 99 at the following times:
2008/10/03_08:39:34
2008/10/03_08:40:40</pre>
 
=={{header|Nim}}==
Line 1,499 ⟶ 1,567:
for i in maxTimes: echo " ",i</lang>
Output:
<pre>Maximum simultaneous license use is 99 at the following times:
2008/10/03_08:39:34
2008/10/03_08:40:40</pre>
 
=={{header|OCaml}}==
Line 1,535 ⟶ 1,603:
=={{header|Oz}}==
{{trans|Python}}
 
<lang oz>declare
fun {MaxLicenses Filename ?Times}
Line 1,586 ⟶ 1,655:
 
Output:
<pre>
Maximum simultaneous license use is 99 at the following times:
Maximum simultaneous license use is 99 at the following times:
2008/10/03_08:39:34
2008/10/03_08:4039:4034
2008/10/03_08:40:40
</pre>
 
=={{header|PARI/GP}}==
Line 1,609 ⟶ 1,680:
rec
};</lang>
<pre>["2008/10/03_08:39:34", "2008/10/03_08:40:40"]
%1 = 99</pre>
 
=={{header|Perl}}==
Line 1,641 ⟶ 1,712:
print " $_\n" foreach @max_times;</lang>
Example output:
<pre>Maximum simultaneous license use is 99 at the following times:
2008/10/03_08:39:34
2008/10/03_08:40:40
</pre>
 
 
=={{header|Perl 6}}==
Line 1,679 ⟶ 1,750:
 
Example output:
<pre>
Maximum concurrent licenses in use: 99, in the time periods:
Maximum concurrent licenses in use: 99, in the time periods:
2008/10/03_08:39:34 through 2008/10/03_08:39:45,
2008/10/03_08:4039:4034 through 2008/10/03_08:4039:4745,
2008/10/03_08:40:40 through 2008/10/03_08:40:47
</pre>
 
=={{header|Phix}}==
Line 1,720 ⟶ 1,793:
end for</lang>
{{out}}
<pre>
Maximum simultaneous license use is 99 at the following times:
Maximum simultaneous license use is 99 at the following times:
2008/10/03_08:39:34
2008/10/03_08:4039:4034
2008/10/03_08:40:40
</pre>
 
=={{header|PHP}}==
Line 1,754 ⟶ 1,829:
echo $times[$i] . '<br>';
}</lang>
<pre>
99
99
2008/10/03_08:39:34
2008/10/03_08:4039:4034
2008/10/03_08:40:40
</pre>
 
=={{header|PL/I}}==
<lang pli>
<lang pli>text3: procedure options (main); /* 19 November 2011 */
text3: procedure options (main); /* 19 November 2011 */
declare line character (80) varying;
declare (nout, max_nout) fixed;
Line 1,794 ⟶ 1,872:
free saveline;
end;
end text3;</lang>
</lang>
OUTPUT:
<pre>
The maximum number of licences taken out = 99
The maximum number of licences taken out = 99
It occurred at 2008/10/03_08:40:40 for job 1837
It occurred at 2008/10/03_08:3940:3440 for job 18331837
It occurred at 2008/10/03_08:39:34 for job 1833
</pre>
 
=={{header|PicoLisp}}==
{{trans|AWK}}
 
Put the following into an executable file "licenses":
<lang PicoLisp>#!/usr/bin/picolisp /usr/lib/picolisp/lib.l
Line 1,823 ⟶ 1,905:
(bye)</lang>
Then it can be called as
<pre>$ ./licenses mlijobs.txt
The biggest number of licenses is 99 at 2008/10/03_08:39:34 and 2008/10/03_08:40:40 !</pre>
 
=={{header|PowerShell}}==
<lang PowerShell>[int]$count = 0
[int]$count = 0
[int]$maxCount = 0
[datetime[]]$times = @()
Line 1,871 ⟶ 1,954:
StartTime = $times[0]
EndTime = $times[1]
}
}</lang>
</lang>
{{Out}}
<pre>
LicensesOut StartTime EndTime
-----------LicensesOut ---------StartTime -------EndTime
----------- --------- -------
99 10/3/2008 8:39:34 AM 10/3/2008 8:40:40 AM
99 10/3/2008 8:39:34 AM 10/3/2008 8:40:40 AM
</pre>
 
=={{header|PureBasic}}==
Line 1,903 ⟶ 1,989:
PrintN(#CRLF$+"Press ENTER to exit"): Input()
CloseConsole()</lang>
<pre>
99 license(s) used at ;
99 license(s) used at ;
2008/10/03_08:39:34
2008/10/03_08:4039:4034
2008/10/03_08:40:40
 
Press ENTER to exit
Press ENTER to exit
</pre>
 
=={{header|Python}}==
Line 1,920 ⟶ 2,008:
print("Maximum simultaneous license use is %i at the following times:" % max_out)
print(' ' + '\n '.join(max_times))</lang>
 
{{out}}
<pre>Maximum simultaneous license use is 99 at the following times:
2008/10/03_08:39:34
2008/10/03_08:40:40
</pre>
 
=={{header|R}}==
<lang R>
<lang R># Read in data, discard useless bits
# Read in data, discard useless bits
dfr <- read.table("mlijobs.txt")
dfr <- dfr[,c(2,4)]
Line 1,935 ⟶ 2,026:
when.most.checked.out <- times[which(n.checked.out==most.checked.out)]
# As a bonus, plot license use
plot(times, n.checked.out, type="s")</lang>
</lang>
 
=={{header|Racket}}==
Line 1,963 ⟶ 2,055:
(printf "Maximum licences in simultaneously used is ~a at the following times:~%"
max-used)
(for-each displayln max-used-when)</lang>
</lang>
Output:
<pre>Maximum licences in simultaneously used is 99 at the following times:
2008/10/03_08:39:34
2008/10/03_08:40:40</pre>
 
The following takes advantage of a combination of ''for/fold'' and ''(in-lines)'' (and is possible more in the Racket idiom, rather than just using ''(read-line)'' and ''(regexp-match)'':
 
Line 2,018 ⟶ 2,112:
end /*j*/ /*stick a fork in it, we're all done. */</lang>
'''output''' &nbsp; when using the default input file:
<pre>
<pre>10000 records read from the input file: LICENSE.LOG
10000 records read from the input file: LICENSE.LOG
The maximum number of licenses out is 99 at:
 
2008/10/03_08:39:34 for job 1833
2008/10/03_08:40:40 for job 1837</pre>
</pre>
 
===Version 2 dual-coded for PC and TSO===
It should be noted that almost every REXX interpreter returns a different string for &nbsp; '''parse source''' &nbsp; under Microsoft Windows:
Line 2,101 ⟶ 2,198:
Return</lang>
{{out}} on Windows
<pre>D:\>rexx maxl
D:\>rexx maxl
WindowsNT COMMAND D:\maxl.rex
The maximum number of licences taken out = 99
Line 2,166 ⟶ 2,264:
 
Example output:
<pre>Maximum simultaneous license use is 99 at the following times:
2008/10/03_08:39:34
2008/10/03_08:40:40
</pre>
=={{header|Run BASIC}}==
<lang lb>open "c:\data\temp\logFile.txt" for input as #f
Line 2,183 ⟶ 2,282:
wend
print maxCount;" ";theDate$</lang>
 
=={{header|Scala}}==
=== Dumb imperative translations ===
The boolean logic e.g. is rather clumsy.
{{trans|Ada}}
{{trans|ALGOL 68}}
{{trans|AutoHotkey}}
{{trans|AWK}}
{{trans|Common Lisp}}
{{trans|E}}
{{trans|Fortran}}
{{trans|Go}}
{{trans|Python}}
{{trans|Java}}
{{trans|Julia}}
{{trans|MAXScript}}
{{trans|Nim}}
{{trans|OCaml}}
{{trans|Perl}}
{{trans|PL/I}}
{{trans|PureBasic}}
{{trans|R}}
{{trans|REXX}}
{{trans|Ruby}}
{{trans|Run BASIC}}
{{trans|Sidef}}
{{trans|Tcl}}
{{trans|Zcl}}
{{Out}}Best seen running in your browser [https://scastie.scala-lang.org/lTzl4t0cRFORGs9YWtvgAQ Scastie (remote JVM)].
<lang Scala>import java.io.{BufferedReader, InputStreamReader}
import java.net.URL
 
object License0 extends App {
val url = new URL("https://raw.githubusercontent.com/def-/nim-unsorted/master/mlijobs.txt")
val in = new BufferedReader(new InputStreamReader(url.openStream()))
 
val dates = new collection.mutable.ListBuffer[String]
var (count: Int, max: Int) = (0, Int.MinValue)
var line: String = _
 
while ( {line = in.readLine; line} != null) {
if (line.startsWith("License OUT ")) count += 1
if (line.startsWith("License IN ")) count -= 1 // Redundant test when "OUT"
if (count > max) { // Fruitless execution when "License IN "
max = count
val date = line.split(" ")(3)
dates.clear()
dates += date
} else if (count == max) {
val date = line.split(" ")(3)
dates += date
}
}
 
println("Max licenses out: " + max)
println("At time(s): " + dates)
 
}</lang>
{{in progress|lang=LANG|day=DD|month=MM|year=YYYY}}
//
 
=={{header|Seed7}}==
Line 2,278 ⟶ 2,317:
end for;
end func;</lang>
 
Output:
<pre>
Maximum simultaneous license use is 99 at the following times:
Maximum simultaneous license use is 99 at the following times:
2008/10/03_08:39:34
2008/10/03_08:4039:4034
2008/10/03_08:40:40
</pre>
 
=={{header|Sidef}}==
Line 2,303 ⟶ 2,345:
max_times.each {|t| " #{t}".say };</lang>
{{out}}
<pre>
$ sidef max_licenses.sf < mlijobs.txt
$ sidef max_licenses.sf < mlijobs.txt
Maximum simultaneous license use is 99 at the following times:
Maximum simultaneous license use is 99 at the following times:
2008/10/03_08:39:34
2008/10/03_08:40:40
</pre>
 
=={{header|Tcl}}==
 
{{trans|Python}}
 
<lang tcl> set out 0
set max_out -1
Line 2,333 ⟶ 2,379:
puts " $t"
}</lang>
 
Output matches Python
=={{header|TUSCRIPT}}==
<lang tuscript>$$ MODE TUSCRIPT
$$ MODE TUSCRIPT
joblog="mlijobs.txt",jobnrout=0
log=FILE (joblog)
Line 2,352 ⟶ 2,400:
times=SELECT (time,#maxlicout)
PRINT "The max. number of licences out is ", maxlicout
PRINT "at these times: ", times</lang>
</lang>
Output:
<pre>
The max. number of licences out is 99
The max. number of licences out is 99
at these times: 2008/10/03_08:39:34 2008/10/03_08:40:40
at these times: 2008/10/03_08:39:34 2008/10/03_08:40:40
</pre>
 
=={{header|Ursala}}==
Four functions are defined. Log lexes the log file, which can be accessed as a pre-declared constant without explicit I/O by being given as a compile-time command line parameter. Scan accumulates running totals of licenses in use. Search identifies the maxima, and format transforms the results to human readable form.
 
<lang Ursala>#import std
<lang Ursala>
#import std
#import nat
 
Line 2,371 ⟶ 2,424:
main = format search scan log</lang>
output:
<pre>99 licenses in use at
2008/10/03_08:39:34
2008/10/03_08:40:40
</pre>
 
=={{header|Vedit macro language}}==
Line 2,403 ⟶ 2,457:
Reg_Type(10)
 
Buf_Quit(OK)</lang>
</lang>
 
Output:
<pre>
<pre>Maximum simultaneous license use is 99 at the following times:
Maximum simultaneous license use is 99 at the following times:
2008/10/03_08:39:34 for job 1833
2008/10/03_08:40:40 for job 1837</pre>
</pre>
 
=={{header|zkl}}==
Line 2,423 ⟶ 2,480:
" the following times:\n %s").fmt(maxOut,maxTimes.concat("\n")));</lang>
{{out}}
<pre>
<pre>Maximum simultaneous license use is 1 at the following times:
Maximum simultaneous license use is 1 at the following times:
2008/10/03_23:51:05</pre>
2008/10/03_23:51:05
</pre>
 
 
{{omit from|GUISS}}
10,327

edits