aiken/examples/aiken_std/lib/aiken/bytearray.ak

22 lines
494 B
Plaintext

use aiken/builtin
pub fn slice(bytes: ByteArray, start: Int, end: Int) -> ByteArray {
builtin.sliceByteArray(start, end, bytes)
}
pub fn length(bytes: ByteArray) -> Int {
builtin.lengthOfByteArray(bytes)
}
pub fn is_empty(bytes: ByteArray) -> Bool {
length(bytes) == 0
}
pub fn concat(left front: ByteArray, right back: ByteArray) -> ByteArray {
builtin.appendByteArray(front, back)
}
pub fn prepend(rest: ByteArray, byte: Int) -> ByteArray {
builtin.consByteArray(byte, rest)
}