Primitives: Difference between revisions

879 bytes added ,  2 years ago
(link named primitives)
Line 1:
KfK'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.
Line 23:
| <code>+</code>
|
| || [[transpose]] || [[add]] || [[transpose]]||[[add]]
|-
| <code>-</code>
|
| || [[negate]] || [[subtract]] || [[negate]]||[[subtract]]
|-
| <code>*</code>
|
| || [[first]] || [[multiply]] || [[first]]||[[multiply]]
|-
| <code>%</code>
|[[reciprocal]]
| || [[square root]] || [[divide]] || ||[[divide]]
|-
| <code>!</code>
|
| || [[enum]], [[odometer]], [[keys]] || [[mod]], [[create dict]] || [[enum]] ([[odometer]]), [[keys]]||[[create dict]]
|-
| <code>&amp;</code>
|
| || [[where]] || [[min]] || [[where]]||[[min]]
|-
| <code>&#124;</code>
|
| || [[reverse]] || [[max]] || [[reverse]]||[[max]]
|-
| <code>&lt;</code>
|
| || [[grade up]] || [[lesser]] || [[Grade up|ascending]]||[[lesser]]
|-
| <code>&gt;</code>
|
| || [[grade down]]|| [[greater]] || [[Grade down|descending]]||[[greater]]
|-
| <code>=</code>
|
| || [[group]], [[identity matrix]] || [[equal]] || [[group]]||[[equal]]
|-
| <code>~</code>
|
| || [[not]] || [[match]] || [[not]]||[[match]]
|-
| <code>,</code>
|
| || [[enlist]] || [[concatenate]] || [[enlist]]||[[concatenate]]
|-
| <code>^</code>
Line 75:
| <code>#</code>
|
| || [[length]] || [[take]], [[reshape]]|| [[count]]|| [[filter]], [[take]]
|-
| <code>_</code>
|
| || [[floor]], [[lowercase]] || [[drop]], [[delete]], [[cut]] || [[floor]]|| [[Filter|filter-out]], [[drop]]
|-
| <code>$</code>
|
| || [[string]] || [[pad]], [[cast]] || [[string]]||[[parse]]
|-
| <code>?</code>
|
| || [[distinct]], [[random-float]] || [[find]], [[random]] || [[unique]]||[[find]], [[random]] (with floats)
|-
| <code>@</code>
|[[Type|atom?]]
| || [[type]] || [[at]] || [[type]]|| [[cast]]
|-
| <code>.</code>
|
| || [[eval]], [[values]] || [[dot]] || [[eval]]||[[dot]]
|}
{| class="wikitable"
Line 107:
| [[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 product|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]]?
|
|}
 
Line 136:
! !! K3-K6!! K9
|-
| <code>'</code>|| [[each]] | [[binary search]] ||[[Each|each |]] [[binary search]]
|-
| <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]]||[[scan]] | [[split]] | [[base decode]]
|-
|<code>':</code>||[[each prior]] | [[windows]]||[[each prior]]
|-
|<code>/:</code>||[[each right]]||[[each right]]
|-
|<code>\:</code>||[[each left]]||[[each left]]
|}
5

edits