Allow to trace expressions (and not only string literals)
This however enforces that the argument unifies to a `String`. So this is more flexible than the previous form, but does fundamentally the same thing. Fixes #378.
This commit is contained in:
@@ -1,9 +1,19 @@
|
||||
use aiken/builtin
|
||||
|
||||
fn concat(left: String, right: String) -> String {
|
||||
builtin.append_bytearray(
|
||||
builtin.encode_utf8(left),
|
||||
builtin.encode_utf8(right),
|
||||
)
|
||||
|> builtin.decode_utf8
|
||||
}
|
||||
|
||||
fn is_negative(i: Int) -> Bool {
|
||||
if i < 0 {
|
||||
trace("is negative")
|
||||
True
|
||||
} else {
|
||||
trace("is non-negative")
|
||||
trace(concat("is", concat(" ", "non-negative")))
|
||||
False
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user