Files
kraken/new_kraken_test.kp
2020-12-22 19:24:54 -05:00

39 lines
972 B
Plaintext

#lang (with_import "./new_kraken.kp" new_kraken_untyped)
{
let my_var = 1337
(println $"this is string interpolation: $(+ 1 3 4) <- cool right? another $my_var yep even variables")
obj Point( x y ) {
add |self other| { Point((+ self.x other.x) (+ self.y other.y)) }
sub |self other| { Point((- self.x other.x) (- self.y other.y)) }
to_str |self| { str("x: " self.x ", y: " self.y) }
}
fun say_hi(name) {
println("hayo" name)
}
fun test() {
let plus_1 = |x| (+ x 1)
let a = 1
let b = plus_1(a)
println("some" b)
say_hi("Marcus")
let p1 = Point(1 2)
let p2 = Point(3 4)
let p3 = p1.add(p2)
let p4 = p1.sub(p2)
say_hi("Charlie/Betty")
println("p1:" p1.to_str)
println("p2:" p2.to_str)
println("p3:" p3.to_str)
println("p4:" p4.to_str)
(+ a b)
}
println("Test result is" test())
}