Files
kraken/new_kraken_test.kp

42 lines
1.1 KiB
Plaintext

#lang (with_import "./new_kraken.kp" new_kraken_untyped) new_kraken_start_symbol
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)
println("before + a b" +(a b))
with_import("./import_test.kp" println("after + a b" +(a b)))
println("post after + a b" +(a b))
with_import "./import_test.kp":
println("post new impot after + a b" +(a b))
}
println("Test result is" test())