Primitives: Difference between revisions
("Remove trailing whitespace") |
("Better table captions") |
||
Line 8: | Line 8: | ||
Empty cells indicate that the primitives are the same as K4-K6. |
Empty cells indicate that the primitives are the same as K4-K6. |
||
{| class="wikitable" |
{| class="wikitable" |
||
|+ Table of |
|+ Table of operator verbs in major dialects |
||
|- |
|- |
||
! rowspan=2| |
! rowspan=2| |
||
Line 98: | Line 98: | ||
|} |
|} |
||
{| class="wikitable" |
{| class="wikitable" |
||
|+Table of special forms |
|||
|+Special Forms |
|||
! |
! |
||
!Polyadic Name |
!Polyadic Name |
||
Line 122: | Line 122: | ||
{| class="wikitable" |
{| class="wikitable" |
||
|+Table of named |
|+Table of named verbs in various implementations |
||
! |
! |
||
![[OK|oK]] |
![[OK|oK]] |
Revision as of 07:59, 9 July 2022
K's primitives are designed to fit a large range of diverse functionality within the ASCII character set. This makes it typable on a keyboard, while keeping the language expressive and interesting to use.
All of K's primitives are made to be multipurpose, and have varied meanings based on the context they are used in. Symbol primitives can be either 1 or 2 characters long.
Verbs
Single argument forms(monadic) listed first, two-argument forms(dyadic) listed second.
Empty cells indicate that the primitives are the same as K4-K6.
K3 | K4,K5,K6 | K9* | ||||
---|---|---|---|---|---|---|
monad | dyad | monad | dyad | monad | dyad | |
:
|
identity | right | ||||
+
|
transpose | add | transpose | add | ||
-
|
negate | subtract | negate | subtract | ||
*
|
first | multiply | first | multiply | ||
%
|
reciprocal | square root | divide | divide | ||
!
|
rotate, mod | enum, odometer, keys | mod, create dict | enum (odometer), keys | create dict | |
&
|
where | min | where | min | ||
|
|
reverse | max | reverse | max | ||
<
|
grade up | lesser | ascending | lesser | ||
>
|
grade down | greater | descending | greater | ||
=
|
group, identity matrix | equal | group | equal | ||
~
|
not | match | not | match | ||
,
|
enlist | concatenate | enlist | concatenate | ||
^
|
shape | power | null? | except, fill | sort | cut |
#
|
length | take, reshape | count | filter, take | ||
_
|
floor, lowercase | drop, delete, cut | floor | filter-out, drop | ||
$
|
string | pad, cast | string | parse | ||
?
|
distinct, random-float | find, random | unique | find, random | ||
@
|
atom? | type | at | type | cast | |
.
|
eval, values | dot | eval | dot |
Polyadic Name | |
---|---|
@
|
amend |
.
|
deep amend, try |
$
|
if |
!
|
update (K4/qdb) |
?
|
splice |
?
|
select (K4/qdb) |
oK | K7 | K9* | |
---|---|---|---|
utility | in prm | in within bin like find freq prm cmb | in bin within prm freq cmb |
math | sin cos exp log | sqrt sin cos abs log exp rand | sin cos log div exp sqr sqrt dot bar deltas sum sums rand |
stats | count first last min max sum avg var dev med | count first last avg med mode var mavg msum | |
table(K7+) | asc dsc key | top key unkey meta | |
misc | min max asc | min max countd |
Adverbs
K3,K4,K5,K6 | K9* | |
---|---|---|
' |
each | binary search** | each | binary search** |
/ |
over | fixedpoint | for | while | join** | base encode | over | join** | base encode |
\ |
scan | scan-fixedpoint | scan-for | scan-while | split** | base decode | scan | split** | base decode |
': |
each prior | windows | each prior |
/: |
each right | each right |
\: |
each left | each left |
*: K9 is a nascent dialect which is still currently undergoing changes. Some pages may not be up to date with the latest build, and some are intentionally left unwritten in case of later changes.
**: The primitives base encode, base decode, binary search, join and split are verbs in the adverb syntax space. They are distinguished by argument type.