Kap: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
m (Fix formatting error)
No edit summary
(8 intermediate revisions by 2 users not shown)
Line 3: Line 3:
| index origin            = 0
| index origin            = 0
| function styles          = block (like [[dfn]]s)
| function styles          = block (like [[dfn]]s)
| numeric types            = 64-bit float, 64-bit integer, complex (64-bit float components)
| numeric types            = 64-bit float, 64-bit integer, complex (64-bit float components), unlimited precision big rationals
| unicode support          = full
| unicode support          = full
| released                = 2020
| released                = 2020
| developer                = [[Elias Mårtenson]]
| developer                = [[Elias Mårtenson]]
| latest release version  = 2022 (unversioned)
| latest release version  = 2023 (unversioned)
| implementation language  = [[wikipedia:Kotlin (programming language)|Kotlin]]
| implementation language  = [[wikipedia:Kotlin (programming language)|Kotlin]]
| source                  = [https://github.com/lokedhs/array GitHub]
| source                  = [https://codeberg.org/loke/array Codeberg]
| platforms                = JVM, Native Linux, In-browser, [[wikipedia:Node.js|Node.js]]
| platforms                = JVM, Native Linux, In-browser, [[wikipedia:Node.js|Node.js]]
| license                  = [[wikipedia:MIT License|MIT]]
| license                  = [[wikipedia:MIT License|MIT]]
Line 15: Line 15:
| documentation            = [https://kapdemo.dhsdevelopments.com/kap-comparison.html KAP for APL’ers]
| documentation            = [https://kapdemo.dhsdevelopments.com/kap-comparison.html KAP for APL’ers]
| file ext                = .kap
| file ext                = .kap
| influenced by            = [[Dyalog APL]], [[GNU APL]]
| influenced by            = [[Dyalog APL]], [[GNU APL]], [[BQN]]
| run online              = [https://kapdemo.dhsdevelopments.com/clientweb2/ JS Client]
| run online              = [https://kapdemo.dhsdevelopments.com/clientweb2/ JS Client]
}}
}}
Line 23: Line 23:
== Lazy evaluation ==
== 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, <source lang=apl inline>↑ f¨ ⍳10</source> will only make a single call to <source lang=apl inline>f</source> because <code>f¨ ⍳10</code> 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.
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, <syntaxhighlight lang=apl inline>↑ f¨ ⍳10</syntaxhighlight> will only make a single call to <syntaxhighlight lang=apl inline>f</syntaxhighlight> because <code>f¨ ⍳10</code> 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 ==
== Differences from APL ==
Line 30: Line 30:


* Lazy evaluation
* Lazy evaluation
* All values are immutable, it is not possible to modify the content of an array
* First class functions
* Bignum support and rational arithmetic
* Ability to define custom syntax
* Ability to define custom syntax
* Native hash table support
* Native hash table support
* Parallel evaluation (to take advantage of multi-core CPU's)
{{APL dialects}}[[Category:APL dialects]][[Category:Nested array languages]][[Category:Leading axis languages]]
{{APL dialects}}[[Category:APL dialects]][[Category:Nested array languages]][[Category:Leading axis languages]]

Revision as of 17:29, 14 April 2023


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:

  • 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)
APL dialects [edit]
Maintained APL+WinAPL2APL64APL\ivApletteAprilCo-dfnsDyalog APLDyalog APL Visiondzaima/APLGNU APLKapNARS2000Pometo
Historical A Programming LanguageA+ (A) ∙ APL#APL2CAPL\360APL/700APL\1130APL\3000APL.68000APL*PLUSAPL.jlAPL.SVAPLXExtended Dyalog APLIverson notationIVSYS/7090NARSngn/aplopenAPLOperators and FunctionsPATRowanSAXSHARP APLRationalized APLVisualAPL (APLNext) ∙ VS APLYork APL
Derivatives AHPLBQNCoSyELIGleeIIvyJJellyK (Goal, Klong, Q) ∙ KamilaLispLang5LilNialRADUiua
Overviews Comparison of APL dialectsTimeline of array languagesTimeline of influential array languagesFamily tree of array languages