|
|
Line 518: |
Line 518: |
|
<pre> |
|
<pre> |
|
99 |
|
99 |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
|
|
|
⚫ |
|
|
|
|
|
⚫ |
<lang clojure>(defn delta |
|
⚫ |
"Determines if the number of licences out should be increased or decreased |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
(case (second (re-find #"\ (.*)\ @" entry)) |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
(throw (Exception. (str "Invalid entry:" entry))))) |
|
|
|
|
⚫ |
|
|
⚫ |
"Extracts the time component of an entry." |
|
⚫ |
|
|
⚫ |
(second (re-find #"@\ (.*)\ f" entry))) |
|
|
|
|
⚫ |
|
|
⚫ |
"Builds a map where keys are the number of licences out and the values are the |
|
⚫ |
times where we reached that number." |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
(let [new (+ (delta entry) last)] |
|
⚫ |
[(update m new concat [(time entry)]) |
|
⚫ |
|
|
⚫ |
|
|
|
|
|
⚫ |
(let [data (process (clojure.string/split (slurp "mlijobs.txt") #"\n")) |
|
⚫ |
m (apply max (keys data))] |
|
⚫ |
(println "Maximum simultaneous license use is" m "at the following times:") |
|
⚫ |
(map println (data m)))</lang> |
|
|
|
|
⚫ |
|
|
⚫ |
Maximum simultaneous license use is 99 at the following times: |
|
2008/10/03_08:39:34 |
|
2008/10/03_08:39:34 |
|
2008/10/03_08:40:40 |
|
2008/10/03_08:40:40 |
Line 614: |
Line 653: |
|
GOBACK |
|
GOBACK |
|
.</lang> |
|
.</lang> |
|
|
|
⚫ |
|
|
|
|
|
⚫ |
<lang clojure>(defn delta |
|
⚫ |
"Determines if the number of licences out should be increased or decreased |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
(case (second (re-find #"\ (.*)\ @" entry)) |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
(throw (Exception. (str "Invalid entry:" entry))))) |
|
|
|
|
⚫ |
|
|
⚫ |
"Extracts the time component of an entry." |
|
⚫ |
|
|
⚫ |
(second (re-find #"@\ (.*)\ f" entry))) |
|
|
|
|
⚫ |
|
|
⚫ |
"Builds a map where keys are the number of licences out and the values are the |
|
⚫ |
times where we reached that number." |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
(let [new (+ (delta entry) last)] |
|
⚫ |
[(update m new concat [(time entry)]) |
|
⚫ |
|
|
⚫ |
|
|
|
|
|
⚫ |
(let [data (process (clojure.string/split (slurp "mlijobs.txt") #"\n")) |
|
⚫ |
m (apply max (keys data))] |
|
⚫ |
(println "Maximum simultaneous license use is" m "at the following times:") |
|
⚫ |
(map println (data m)))</lang> |
|
|
|
|
⚫ |
|
|
⚫ |
Maximum simultaneous license use is 99 at the following times: |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
|
|
|
|
|
=={{header|Common Lisp}}== |
|
=={{header|Common Lisp}}== |