q | k | 注释 | 示例 |
---|---|---|---|
neg | -: | 取负,取相反数 | neg 2 -> -2; neg -2 -> 2 |
not | ~: | 逻辑运算not | not 2 -> 0b; not 0 -> 1b |
null | ^: | 逻辑运算是否为空 | null 5 -> 0b; null (::) -> 1b |
string | $: | 转换为字符串 | string 22 -> "22" |
reciprocal | %: | 倒数 | reciprocal 2 -> 0.5; reciprocal 3-> 0.3333333 |
floor | _: | 下取整 | floor 4.2 -> 4; floor 3.8 -> 3 |
ceiling | -_- | 上取整 | ceiling 4.2 -> 5; ceiling 3.8 -> 4 |
count | #: | 计数,长度 | count 2 3 4 -> 3; count "hello world" -> 11 |
first | *: | 取头,第一项 | first 2 3 4 -> 2; first "hello world -> "h"" |
以上函数皆为将k的操作符转换为单元运算,所有代码皆可在q.k中找到
网友评论