Added asserts to select()

This commit is contained in:
Revar Desmera 2020-03-25 15:05:27 -07:00
parent a102663b1a
commit 8cd0168f27
2 changed files with 4 additions and 1 deletions

View file

@ -47,8 +47,11 @@ function select(list, start, end=undef) =
end==undef? ( end==undef? (
is_num(start)? is_num(start)?
let(s=(start%l+l)%l) list[s] : let(s=(start%l+l)%l) list[s] :
assert(is_list(start) || is_range(start), "Invalid start parameter")
[for (i=start) list[(i%l+l)%l]] [for (i=start) list[(i%l+l)%l]]
) : ( ) : (
assert(is_num(start), "Invalid start parameter.")
assert(is_num(end), "Invalid end parameter.")
let(s=(start%l+l)%l, e=(end%l+l)%l) let(s=(start%l+l)%l, e=(end%l+l)%l)
(s<=e)? (s<=e)?
[for (i = [s:1:e]) list[i]] : [for (i = [s:1:e]) list[i]] :

View file

@ -8,7 +8,7 @@
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
BOSL_VERSION = [2,0,226]; BOSL_VERSION = [2,0,227];
// Section: BOSL Library Version Functions // Section: BOSL Library Version Functions