Primitives: Difference between revisions
Content added Content deleted
(link named primitives) |
|||
Line 1: | Line 1: | ||
fK'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. |
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. |
||
Line 23: | Line 23: | ||
| <code>+</code> |
| <code>+</code> |
||
| |
| |
||
| || [[transpose]] || [[add]] || || |
| || [[transpose]] || [[add]] || [[transpose]]||[[add]] |
||
|- |
|- |
||
| <code>-</code> |
| <code>-</code> |
||
| |
| |
||
| || [[negate]] || [[subtract]] || || |
| || [[negate]] || [[subtract]] || [[negate]]||[[subtract]] |
||
|- |
|- |
||
| <code>*</code> |
| <code>*</code> |
||
| |
| |
||
| || [[first]] || [[multiply]] || || |
| || [[first]] || [[multiply]] || [[first]]||[[multiply]] |
||
|- |
|- |
||
| <code>%</code> |
| <code>%</code> |
||
|[[reciprocal]] |
|[[reciprocal]] |
||
| || [[square root]] || [[divide]] || || |
| || [[square root]] || [[divide]] || ||[[divide]] |
||
|- |
|- |
||
| <code>!</code> |
| <code>!</code> |
||
| |
| |
||
| || [[enum]], [[odometer]], [[keys]] || [[mod]], [[create dict]] || || |
| || [[enum]], [[odometer]], [[keys]] || [[mod]], [[create dict]] || [[enum]] ([[odometer]]), [[keys]]||[[create dict]] |
||
|- |
|- |
||
| <code>&</code> |
| <code>&</code> |
||
| |
| |
||
| || [[where]] || [[min]] || || |
| || [[where]] || [[min]] || [[where]]||[[min]] |
||
|- |
|- |
||
| <code>|</code> |
| <code>|</code> |
||
| |
| |
||
| || [[reverse]] || [[max]] || || |
| || [[reverse]] || [[max]] || [[reverse]]||[[max]] |
||
|- |
|- |
||
| <code><</code> |
| <code><</code> |
||
| |
| |
||
| || [[grade up]] || [[lesser]] || || |
| || [[grade up]] || [[lesser]] || [[Grade up|ascending]]||[[lesser]] |
||
|- |
|- |
||
| <code>></code> |
| <code>></code> |
||
| |
| |
||
| || [[grade down]]|| [[greater]] || || |
| || [[grade down]]|| [[greater]] || [[Grade down|descending]]||[[greater]] |
||
|- |
|- |
||
| <code>=</code> |
| <code>=</code> |
||
| |
| |
||
| || [[group]], [[identity matrix]] || [[equal]] || || |
| || [[group]], [[identity matrix]] || [[equal]] || [[group]]||[[equal]] |
||
|- |
|- |
||
| <code>~</code> |
| <code>~</code> |
||
| |
| |
||
| || [[not]] || [[match]] || || |
| || [[not]] || [[match]] || [[not]]||[[match]] |
||
|- |
|- |
||
| <code>,</code> |
| <code>,</code> |
||
| |
| |
||
| || [[enlist]] || [[concatenate]] || || |
| || [[enlist]] || [[concatenate]] || [[enlist]]||[[concatenate]] |
||
|- |
|- |
||
| <code>^</code> |
| <code>^</code> |
||
Line 75: | Line 75: | ||
| <code>#</code> |
| <code>#</code> |
||
| |
| |
||
| || [[length]] || [[take]], [[reshape]]|| || [[filter]] |
| || [[length]] || [[take]], [[reshape]]|| [[count]]|| [[filter]], [[take]] |
||
|- |
|- |
||
| <code>_</code> |
| <code>_</code> |
||
| |
| |
||
| || [[floor]], [[lowercase]] || [[drop]], [[delete]], [[cut]] || || [[Filter|filter-out]] |
| || [[floor]], [[lowercase]] || [[drop]], [[delete]], [[cut]] || [[floor]]|| [[Filter|filter-out]], [[drop]] |
||
|- |
|- |
||
| <code>$</code> |
| <code>$</code> |
||
| |
| |
||
| || [[string]] || [[pad]], [[cast]] || || |
| || [[string]] || [[pad]], [[cast]] || [[string]]||[[parse]] |
||
|- |
|- |
||
| <code>?</code> |
| <code>?</code> |
||
| |
| |
||
| || [[distinct]], [[random-float]] || [[find]], [[random]] || || |
| || [[distinct]], [[random-float]] || [[find]], [[random]] || [[unique]]||[[find]], [[random]] (with floats) |
||
|- |
|- |
||
| <code>@</code> |
| <code>@</code> |
||
|[[Type|atom?]] |
|[[Type|atom?]] |
||
| || [[type]] || [[at]] || || [[cast]] |
| || [[type]] || [[at]] || [[type]]|| [[cast]] |
||
|- |
|- |
||
| <code>.</code> |
| <code>.</code> |
||
| |
| |
||
| || [[eval]], [[values]] || [[dot]] || || |
| || [[eval]], [[values]] || [[dot]] || [[eval]]||[[dot]] |
||
|} |
|} |
||
{| class="wikitable" |
{| class="wikitable" |
||
Line 107: | Line 107: | ||
| [[in]] [[prm]] |
| [[in]] [[prm]] |
||
| [[in]] [[within]] [[bin]] [[like]] [[find]] [[freq]] [[prm]] [[cmb]] |
| [[in]] [[within]] [[bin]] [[like]] [[find]] [[freq]] [[prm]] [[cmb]] |
||
|[[in]] [[bin]] [[within]] [[has]] [[prm]] [[freq]] [[cmb]] |
|||
| |
|||
|- |
|- |
||
|math |
|math |
||
| [[sin]] [[cos]] [[exp]] [[log]] |
| [[sin]] [[cos]] [[exp]] [[log]] |
||
| [[sqrt]] [[sin]] [[cos]] [[abs]] [n][[log]] [n][[exp]] [n][[rand]] |
| [[sqrt]] [[sin]] [[cos]] [[abs]] [n][[log]] [n][[exp]] [n][[rand]] |
||
|[[sin]] [[cos]] [[log]] [[div]](`i) [[exp]] [[sqr]] [[sqrt]] [[Dot product|dot]] [[bar]] [[deltas]] [[sum]] [[sums]] [[rand]] |
|||
| |
|||
|- |
|- |
||
|stats |
|stats |
||
| |
| |
||
|[[count]] [[first]] [[last]] [[min]] [[max]] [[sum]] [[avg]] [[var]] [[dev]] [[med]] |
|[[count]] [[first]] [[last]] [[min]] [[max]] [[sum]] [[avg]] [[var]] [[dev]] [[med]] |
||
|[[count]] [[first]] [[last]] [[avg]] [[med]] [[mode]] [[var]] [[mavg]] [[msum]] |
|||
| |
|||
|- |
|- |
||
|table(K7+) |
|table(K7+) |
||
| |
| |
||
|[[asc]] [[dsc]] [[key]] |
|[[asc]] [[dsc]] [[key]] |
||
|[[top]] [[key]] [[unkey]] [[meta]] |
|||
| |
|||
|- |
|- |
||
|misc |
|misc |
||
| |
| |
||
|[[min]] [[max]] [[asc]] |
|[[min]] [[max]] [[asc]] |
||
|[[min]] [[max]] [[countd]]? |
|||
| |
|||
|} |
|} |
||
Line 136: | Line 136: | ||
! !! K3-K6!! K9 |
! !! K3-K6!! K9 |
||
|- |
|- |
||
| <code>'</code>|| [[each]] | [[binary search]] || |
| <code>'</code>|| [[each]] | [[binary search]] ||[[Each|each |]] [[binary search]] |
||
|- |
|- |
||
| <code>/</code>|| [[over]] | [[fixedpoint]] | [[for]] | [[while]] | [[join]] | [[base encode]]|| |
| <code>/</code>|| [[over]] | [[fixedpoint]] | [[for]] | [[while]] | [[join]] | [[base encode]]||[[over]] | [[join]] | [[base encode]] |
||
|- |
|- |
||
|<code>\</code>|| [[scan]] | [[scan-fixedpoint]] | [[scan-for]] | [[scan-while]] | [[split]] | [[base decode]]|| |
|<code>\</code>|| [[scan]] | [[scan-fixedpoint]] | [[scan-for]] | [[scan-while]] | [[split]] | [[base decode]]||[[scan]] | [[split]] | [[base decode]] |
||
|- |
|- |
||
|<code>':</code>||[[each prior]] | [[windows]]|| |
|<code>':</code>||[[each prior]] | [[windows]]||[[each prior]] |
||
|- |
|- |
||
|<code>/:</code>||[[each right]]|| |
|<code>/:</code>||[[each right]]||[[each right]] |
||
|- |
|- |
||
|<code>\:</code>||[[each left]]|| |
|<code>\:</code>||[[each left]]||[[each left]] |
||
|} |
|} |
Revision as of 06:47, 31 July 2021
fK'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-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 | ||
!
|
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 (with floats) | ||
@
|
atom? | type | at | type | cast | |
.
|
eval, values | dot | eval | dot |
oK | K7 | K9 | |
---|---|---|---|
utility | in prm | in within bin like find freq prm cmb | in bin within has prm freq cmb |
math | sin cos exp log | sqrt sin cos abs [n]log [n]exp [n]rand | sin cos log div(`i) 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-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 |