Kap: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
(Added some more information about KAP)
No edit summary
Line 1: Line 1:
{{Infobox array language
{{Infobox array language
| array model              = [[based array model|based]]
| array model              = [[nested array model|nested]]
| index origin            = 0
| index origin            = 0
| function styles          = block (like [[dfn]]s)
| function styles          = block (like [[dfn]]s)
Line 9: Line 9:
| latest release version  = 2020 (unversioned)
| latest release version  = 2020 (unversioned)
| implementation languages = [[wikipedia:Kotlin_(Programming_Language)|Kotlin]]
| implementation languages = [[wikipedia:Kotlin_(Programming_Language)|Kotlin]]
| source                  = [https://github.com/lokedhs/array]
| source                  = [https://github.com/lokedhs/array GitHub]
| platforms                = JVM, Native, In-browser, [[wikipedia:Node.js|Node.js]]
| platforms                = JVM, Native, In-browser, [[wikipedia:Node.js|Node.js]]
| license                  = MIT
| license                  = MIT
| file ext                = .kap
| file ext                = .kap
| influenced by            = [[APL]], [[Dyalog APL]]
| influenced by            = [[Dyalog APL]]
| run online              = [https://kapdemo.dhsdevelopments.com/]
| run online              = [https://kapdemo.dhsdevelopments.com/ JS Client]
}}
}}


'''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.
'''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.


<h2>Lazy evaluation</h2>
== 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, the following code will only make a single call to the function:
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, the following code will only make a single call to the function:
Line 29: Line 29:
This is because the call to <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.
This is because the call to <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.


<h2>Differences with APL</h2>
== Differences from APL ==


The following is a list of significant differences compared to APL:
The following is a list of significant differences compared to APL:
Line 37: Line 37:
* Ability to define custom syntax
* Ability to define custom syntax
* Native hash table support
* Native hash table support
{{APL dialects}}[[Category:APL dialects]][[Category:Nested array languages]][[Category:Leading axis languages]]

Revision as of 13:13, 26 November 2020


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, the following code will only make a single call to the function:

↑ f¨ ⍳10

This is because the call to 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
  • All values are immutable, it is not possible to modify the content of an array
  • Ability to define custom syntax
  • Native hash table support
APL dialects [edit]
Maintained APL+WinAPL2APL64APL\ivApletteAprilCo-dfnsDyalog APLDyalog APL Visiondzaima/APLGNU APLKapNARS2000PometoTinyAPL
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