Go to file
Elias Mårtenson 963c334526
Cleanup the project files
2023-09-22 22:53:23 +08:00
.idea Add keyboard mapping support for gui2 2023-07-15 18:08:19 +08:00
.run Added run configurations 2023-05-13 14:00:47 +08:00
.woodpecker Added libeditline-dev to woodpecker deps 2023-07-17 21:30:12 +08:00
array Cleanup the project files 2023-09-22 22:53:23 +08:00
client-java Make the nodes in the structure viewer clickable 2023-02-11 00:28:22 +08:00
clientweb Declare pi as a constant 2023-06-05 15:16:17 +08:00
clientweb2 Cleanup the project files 2023-09-22 22:53:23 +08:00
demo Fixed the html renderer for tables 2023-08-30 21:11:19 +08:00
docs Cleanup of the kap comparison document 2023-09-19 22:54:50 +08:00
gradle/wrapper Fixes to the windows script 2023-09-04 01:37:12 +08:00
gui Update kotlin version 2023-09-22 20:11:18 +08:00
gui2 Update kotlin version 2023-09-22 20:11:18 +08:00
kotlin-js-store Initial version of excel import in webclient 2023-06-06 23:04:53 +08:00
mpbignum Cleanup the project files 2023-09-22 22:53:23 +08:00
perf-test Cleanup the project files 2023-09-22 22:53:23 +08:00
perf-test-jvm Moved jvm perf-test to a separate module 2023-05-28 00:59:08 +08:00
scripts Some updates to the tutorial 2023-08-21 20:42:16 +08:00
text-client Update kotlin version 2023-09-22 20:11:18 +08:00
.gitignore Add idea code style options to repository 2023-06-12 20:06:32 +08:00
COPYING Update copyright year 2023-06-03 12:44:13 +08:00
README.md Added a link to the reference documentation 2023-09-15 01:42:50 +08:00
build.gradle Update kotlin version 2023-09-22 20:11:18 +08:00
gradle.properties Some code cleanup 2023-07-22 13:29:39 +08:00
gradlew Upgrade gradle 2021-11-25 18:46:20 +08:00
gradlew.bat Upgrade gradle 2021-11-25 18:46:20 +08:00
settings.gradle Update to kotlin 1.9.0-Beta 2023-05-30 00:37:17 +08:00

README.md

KAP

An implementation of an APL-like language in Kotlin. The implementation is a Kotlin Multiplatform project, and can be compiled to Java, natively and to Javascript.

Summary

As of this writing, a majority of basic APL functionality is available, but some important features are not yet available. The language also has several features that are unique to KAP, such as the ability to define new syntax. Thanks to this, imperative commands such as if and while is implemented in the standard library and are not part of the language itself.

The language also implements first-class functions and closures. All of these features will be documented in a separate document. However, this has not been written yet.

What the language looks like

As a language based on APL, it uses non-ASCII symbols with most fundamental functions being a single character. This may make the language seem complicated, but it's actually rather simple once one learns the general syntax.

The first line of code in the following example assigns a string to the variable A, and the second line splits the string at instances of -, returning an array of arrays (a string in KAP is nothing more than a one-dimensional array of characters):

A ← "this-is-a-demo"
A ⊂⍨ A≠@-

Typing the above code into the REPL will display the following result:

┏━━━━━━━━━━━━━━━━━━━━━━┓
┃"this" "is" "a" "demo"┃
┗━━━━━━━━━━━━━━━━━━━━━━┛

The box around the result indicates that the result is an array. In this case it is a one-dimensional array with 4 elements, each of which is an array of characters (i.e. string).

Running the JavaFX based UI

The most feature-complete way to run KAP is to use the JVM client. It provides a nicer user interface, an editor, highlighting of the location of errors, ability to draw graphics, and many other features.

To start the client, simply run:

./gradlew gui:run

Running the Linux native version

Build the native Linux binary:

./gradlew text-client:linuxMainBinaries

When running the Linux binary, the path to the standard library needs to be passed to the executable:

text-client/build/bin/linux/releaseExecutable/text-client.kexe --lib-path=array/standard-lib

There is currently no support for native compilation on Windows or OSX. As long as the dependencies are available, it should be possible to make it work. Help appreciated if anyone is interested in working on it.

Web client

The application also compiles to Javascript, and it's possible to run it in a browser. Note that some functionality is missing from the Javascript version. For example, network and file operations are currently not implemented.

You can try the web UI here: https://kapdemo.dhsdevelopments.com/clientweb2/

Documentation

Work on the documentation is in progress, but it's still limited.

There is a tutorial which is incomplete: https://kapdemo.dhsdevelopments.com/quick-tutorial.html

The following document explains the differences between KAP and APL, which is useful for readers who already are familiar with APL: https://kapdemo.dhsdevelopments.com/kap-comparison.html

There is also a document containing the reference documentation: https://kapdemo.dhsdevelopments.com/reference.html

Anyone interested in learning more can ask questions on the Matrix channel.

Contributions

The main repository for this project is available from Codeberg: https://codeberg.org/loke/array

For discussions about this project, feel free to join the Matrix channel: #kap:dhsdevelopments.com.