Pure Functions - Non-Deterministic

data class ChatMessage(
    val user: String
    val timestamp: Instant
    val message: String) 


fun newMessage(message: String) : ChatMessage { 
  return ChatMessage(
    user = System.getProperty("user.name"),
    timestamp = Instant.now(),
    message = message)
}

Back Home Next