Kap: Difference between revisions
(∘ is actually Withe) |
m (Congratulations you are now an influencer! (TinyAPL)) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 17: | Line 17: | ||
| file ext = .kap | | file ext = .kap | ||
| influenced by = [[Dyalog APL]], [[GNU APL]], [[BQN]] | | influenced by = [[Dyalog APL]], [[GNU APL]], [[BQN]] | ||
| influenced = [[TinyAPL]] | |||
| run online = [https://kapdemo.dhsdevelopments.com/clientweb2/ JS Client] | | run online = [https://kapdemo.dhsdevelopments.com/clientweb2/ JS Client] | ||
}} | }} | ||
Line 87: | Line 88: | ||
|- | |- | ||
| <syntaxhighlight lang=apl inline>!</syntaxhighlight> || [[Factorial|Gamma]] || [[Binomial]] | | <syntaxhighlight lang=apl inline>!</syntaxhighlight> || [[Factorial|Gamma]] || [[Binomial]] | ||
|- | |||
| <syntaxhighlight lang=apl inline>⍴</syntaxhighlight> || [[Shape]] || [[Reshape]] | |||
|- | |||
| <syntaxhighlight lang=apl inline>⍳</syntaxhighlight> || [[Index generator]] || [[Index of]] | |||
|- | |- | ||
| <syntaxhighlight lang=apl inline>⊢</syntaxhighlight> || [[Identity]] || [[Right]] | | <syntaxhighlight lang=apl inline>⊢</syntaxhighlight> || [[Identity]] || [[Right]] | ||
Line 164: | Line 169: | ||
| <syntaxhighlight lang=apl inline>F⌿</syntaxhighlight> || [[Reduce leading axis]] || [[Windowed reduce leading axis]] | | <syntaxhighlight lang=apl inline>F⌿</syntaxhighlight> || [[Reduce leading axis]] || [[Windowed reduce leading axis]] | ||
|- | |- | ||
| <syntaxhighlight lang=apl inline>F⌻</syntaxhighlight> | | <syntaxhighlight lang=apl inline>F⌻</syntaxhighlight><br/><syntaxhighlight lang=apl inline>•.F</syntaxhighlight> | ||
| || [[Outer product]] | |||
|- | |- | ||
| <syntaxhighlight lang=apl inline>F•G</syntaxhighlight> || || [[Inner product]] | | <syntaxhighlight lang=apl inline>F•G</syntaxhighlight> || || [[Inner product]] | ||
Line 194: | Line 200: | ||
In addition to these, Kap uses the glyphs <syntaxhighlight lang=apl inline>«</syntaxhighlight> and <syntaxhighlight lang=apl inline>»</syntaxhighlight> to form [[Fork]]s. These are not operators, although they resemble them syntactically. | In addition to these, Kap uses the glyphs <syntaxhighlight lang=apl inline>«</syntaxhighlight> and <syntaxhighlight lang=apl inline>»</syntaxhighlight> to form [[Fork]]s. These are not operators, although they resemble them syntactically. | ||
== External links == | |||
* [[Array Cast]] episode 72, [https://www.arraycast.com/episodes/episode72-kap Elias Mårtenson and the Kap array programming language] | |||
== References == | == References == | ||
<references/> | <references/> | ||
{{APL dialects}}[[Category:APL dialects]][[Category:Nested array languages]][[Category:Languages with first-class functions]][[Category:Leading axis languages]] | {{APL dialects}}[[Category:APL dialects]][[Category:Nested array languages]][[Category:Languages with first-class functions]][[Category:Leading axis languages]] |
Latest revision as of 11:53, 29 August 2024
Kap is an array-based language that aims to implement most of standard APL, along with additional features. Much of standard APL works in Kap, although if an APL feature does not fit with Kap's design, those features are changed or removed.
Lazy evaluation
The main difference compared to APL is that Kap is lazy-evaluated. This means that the language gives the developers very loose guarantees when (or if, and how many times) a function will actually be invoked. For example, ↑ f¨ ⍳10
will only make a single call to f
because f¨ ⍳10
will not immediately evaluate the result but only return a delayed evaluation. Since all but the first result is then discarded, those results will never be computed.
Differences from APL
The following is a list of significant differences compared to APL:[1]
- Lazy evaluation
- First class functions
- Bignum support and rational arithmetic
- Ability to define custom syntax
- Native hash table support
- Parallel evaluation (to take advantage of multi-core CPU's)
Primitives
Functions
Operators
Syntax | Monadic | Dyadic |
---|---|---|
F¨ |
For each | |
F/ |
Reduce | Windowed reduce |
F⌿ |
Reduce leading axis | Windowed reduce leading axis |
F⌻ •.F
|
Outer product | |
F•G |
Inner product | |
F⍨ |
Duplicate | Commute |
F⍣k |
Power operator | |
F\ |
Scan | |
F⍀ |
Scan first axis | |
F⍤k |
Rank operator | |
F∵ |
Derive bitwise | |
F∥ |
Parallel | |
F˝ |
Inverse | |
F∘G |
Compose | |
F⍛G |
Inverse compose | |
F⍥G |
Over | |
F⍢G |
Structural under |
In addition to these, Kap uses the glyphs «
and »
to form Forks. These are not operators, although they resemble them syntactically.
External links
References
- ↑ Mårtenson, Elias. Kap for APL’ers. Unversioned. Retrieved 2023-08-13.
APL dialects [edit] | |
---|---|
Maintained | APL+Win ∙ APL2 ∙ APL64 ∙ APL\iv ∙ Aplette ∙ April ∙ Co-dfns ∙ Dyalog APL ∙ Dyalog APL Vision ∙ dzaima/APL ∙ GNU APL ∙ Kap ∙ NARS2000 ∙ Pometo ∙ TinyAPL |
Historical | A Programming Language ∙ A+ (A) ∙ APL# ∙ APL2C ∙ APL\360 ∙ APL/700 ∙ APL\1130 ∙ APL\3000 ∙ APL.68000 ∙ APL*PLUS ∙ APL.jl ∙ APL.SV ∙ APLX ∙ Extended Dyalog APL ∙ Iverson notation ∙ IVSYS/7090 ∙ NARS ∙ ngn/apl ∙ openAPL ∙ Operators and Functions ∙ PAT ∙ Rowan ∙ SAX ∙ SHARP APL ∙ Rationalized APL ∙ VisualAPL (APLNext) ∙ VS APL ∙ York APL |
Derivatives | AHPL ∙ BQN ∙ CoSy ∙ ELI ∙ Glee ∙ I ∙ Ivy ∙ J ∙ Jelly ∙ K (Goal, Klong, Q) ∙ KamilaLisp ∙ Lang5 ∙ Lil ∙ Nial ∙ RAD ∙ Uiua |
Overviews | Comparison of APL dialects ∙ Timeline of array languages ∙ Timeline of influential array languages ∙ Family tree of array languages |