core.list-slice
- description
- The items of list from start (inclusive) to end (exclusive). Splits the range in halves, so it copies O(n log n) items (the same as std.list-range, which core cannot use)
- type
Fn(T: Type, list: List<Param("T")>, start: Number, end: Number) -> List<Param("T")>- expression
fn(T$0, list$1, start$2, end$3) => let length$4 = @core.minus(left: $3, right: $2); match @core.less-than(left: $4, right: 2) { true => match @core.equal(left: $4, right: 1) { true => match @core.list-get(list: $1, index: $2) { #some(item$5) => [$5], #none(_) => [] }, false => [] }, false => let middle$6 = @core.plus(left: $2, right: @core.divide(left: $4, right: 2)); @core.list-concat( left: @core.list-slice(T: $0, list: $1, start: $2, end: $6), right: @core.list-slice(T: $0, list: $1, start: $6, end: $3) ) }
- visibility
- public
core.list-slice (project definy, branch main, snapshot CfIAXM725tR74SWd4aoTUz4-JJQfqnllblZbQ2Sv204) id: FgNyfFY0IMpVAByiyW4bPC54v954TMiNK3nxpH6Wluk content hash: k3mJcvKDzCXaxh75CwzlRZM11NLNrrS0W5vIUuDtNsg