This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns roman.core | |
(:require [clojure.string :as str])) | |
(def grammar '("^M{0,4}" "^CM|^CD|^D?C{0,3}" "^XC|^XL|^L?X{0,3}" "^IX|^IV|^V?I{0,3}")) | |
(def values {:M 1000 :D 500 :C 100 :L 50 :X 10 :V 5 :I 1}) | |
(defn sum-tokens [tokens] | |
(reduce | |
#(if (< %1 %2) (- %2 %1) (+ %1 %2)) | |
(map #((keyword (str %)) values) (seq tokens)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package fi.luotocompany.logger; | |
import java.time.LocalDateTime; | |
import java.time.format.DateTimeFormatter; | |
/** | |
* Simple and secure logger by Kimmo Wikman, Luoto Company | |
*/ | |
public class SimpleLogger { |