Contest
Functional text I/O for programming-contest benchmarks. A program is a pure String -> String transformation; token access is separate from sequencing.
Imports
open Seq;
Table of Contents
Functions
wordCount
wordAt
readInt
showInt
readFloat
showFloat
appendText
character
textLength
wordsFrom
words
integers
joinWords
showIntegers
sameTokens
Functions
wordCount
def wordCount
(text : String)
: Int
wordAt
def wordAt
(text : String)
(index : Int)
: String
readInt
def readInt
(token : String)
: Int
showInt
def showInt
(value : Int)
: String
readFloat
def readFloat
(token : String)
: Float
showFloat
def showFloat
(value : Float)
: String
appendText
def appendText
(left : String)
(right : String)
: String
character
def character
(text : String)
(index : Int)
: String
textLength
def textLength
(text : String)
: Int
wordsFrom
def wordsFrom
(text : String)
(index : Int)
: (Seq String)
words
def words
(text : String)
: (Seq String)
integers
def integers
(text : String)
: (Seq Int)
joinWords
def joinWords
(xs : (Seq String))
: String
showIntegers
def showIntegers
(xs : (Seq Int))
: String
sameTokens
Contest outputs conventionally ignore runs of whitespace. This is an exact token comparison, not a checker for alternate valid witnesses or tolerances.
def sameTokens
(left : String)
(right : String)
: Bool