Redis.len.of: def of bend-kit-redis@0.3.1.0 Import: import bend-kit-redis@0.3.1.0/redis.bend as Redis Lines 299-304 of bend-kit-redis@0.3.1.0/redis.bend: https://jend.leeeet.dev/read.txt?path=bend-kit-redis@0.3.1.0/redis.bend&start_line=299&end_line=304 import Base # A length or count below 2^31; -1 (RESP2 null) is 4294967295 and anything else is 4294967294. def len.of(n: Num) -> U32: Num{+neg, +hi, +lo, +ok} = n +nil = Bool.and(ok, Bool.and(neg, Bool.and(U32.is_eq(hi, 0), U32.is_eq(lo, 1)))) +good = Bool.and(ok, Bool.and(Bool.not(neg), Bool.and(U32.is_eq(hi, 0), U32.is_lt(lo, 2147483648)))) Bool.pick(U32, good, lo, Bool.pick(U32, nil, 4294967295, 4294967294)) Uses (7): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.not https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.pick https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_eq https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_lt https://jend.leeeet.dev/definition.txt?path=bend-kit-redis@0.3.1.0/redis.bend&name=Num