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).
20 lines
389 B
Plaintext
20 lines
389 B
Plaintext
use aiken/builtin
|
|
|
|
pub fn slice(bytes: ByteArray, start: Int, end: Int) -> ByteArray {
|
|
builtin.slice_bytearray(start, end, bytes)
|
|
}
|
|
|
|
pub fn length(bytes: ByteArray) -> Int {
|
|
builtin.length_of_bytearray(bytes)
|
|
}
|
|
|
|
pub fn drop(bytes: ByteArray, n: Int) -> ByteArray {
|
|
slice(bytes, n, length(bytes) - n)
|
|
}
|
|
|
|
test drop_1() {
|
|
let x =
|
|
#"01020304050607"
|
|
drop(x, 2) == #"0304050607"
|
|
}
|