compound ket fn: is-in-range
is-in-range:
description:
is-in-range[value1, value2] ket
returns yes/no if value1 <= the value in ket <= value2
examples:
is-in-range[2,4] ssplit |0123456>
|no> . |no> . |yes> . |yes> . |yes> . |no> . |no>
not |yes> => |no>
not |no> => |yes>
is-a-child |*> #=> is-in-range[0,17] age |_self>
is-a-teenager |*> #=> is-in-range[13,19] age |_self>
is-an-adult |*> #=> not is-in-range[0,17] age |_self>
age |Emma> => |14>
age |Bella> => |18>
age |Fred> => |34>
table[person, age, is-a-child, is-a-teenager, is-an-adult] split[" "] |Emma Bella Fred>
+--------+-----+------------+---------------+-------------+
| person | age | is-a-child | is-a-teenager | is-an-adult |
+--------+-----+------------+---------------+-------------+
| Emma | 14 | yes | yes | no |
| Bella | 18 | no | yes | yes |
| Fred | 34 | no | no | yes |
+--------+-----+------------+---------------+-------------+
-- if the ket has no float value then return the empty ket |>
is-in-range[13, 17] |the cat>
|>
see also:
is-less-than, is-less-equal-than, is-equal, is-greater-than, is-greater-equal-than
Home