Skip to content

Instantly share code, notes, and snippets.

@tangentstorm tangentstorm/something.kt

Last active Aug 29, 2015
Embed
What would you like to do?
first attempt at using kotlin
/**
* Created by michal on 3/25/2014.
*/
import java.util.ArrayDeque
import java.util.Map;
import java.util.HashMap
trait WjData {
}
private class WjNull : WjData {
override fun toString() = "null"
}
class WjInt(val value : Int): WjData {
override fun toString() = value.toString()
}
class WjStr(val value :String) : WjData {
override fun toString() = '"' + super.toString() + '"'
}
class WjStack : ArrayDeque<WjData>(), WjData {
}
class WjDict : HashMap<WjStr, WjData>(), WjData {
}
public val WJNULL : WjData = WjNull()
fun main(args: Array<String>) {
val data = WjStack()
data.push(WJNULL)
data.push(WjInt(5))
data.push(WjStack())
print(data)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.