Kap: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
(Initial version)
 
(Added some more information about KAP)
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
| numeric types            = 64-bit float, 64-bit integer, complex (64-bit float components)
| unicode support          = full
| unicode support          = full
| released                = 2020
| released                = 2020
Line 16: Line 16:
| run online              = [https://kapdemo.dhsdevelopments.com/]
| run online              = [https://kapdemo.dhsdevelopments.com/]
}}
}}
'''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>
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:
<source lang=apl>
↑ f¨ ⍳10
</source>
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>
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

Revision as of 08:25, 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 with 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