This leads to more consistent formatting across entire Aiken programs. Before that commit, only long expressions would be formatted on a newline, causing non-consistent formatting and additional reading barrier when looking at source code. Programs also now take more vertical space, which is better for more friendly diffing in version control systems (especially git).
24 lines
416 B
Plaintext
24 lines
416 B
Plaintext
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 concat(@"is", concat(@" ", @"non-negative"))
|
|
False
|
|
}
|
|
}
|
|
|
|
test trace_1() {
|
|
is_negative(-14) && !is_negative(42)
|
|
}
|