Running K/ngnk: Difference between revisions

no edit summary
No edit summary
Line 1:
== Installing ngn/k ==
 
=== Linux package managers ===
 
==== Arch et al. ====
 
ngn/k is available on the [https://aur.archlinux.org/ AUR] package manager; thus it can be conveniently installed on [https://archlinux.org/ Arch Linux] and related distros, like [https://manjaro.org/ Manjaro].
 
=== Compiling from source ===
 
The ngn/k repo contains a makefile that will build an executable <code>k</code> binary. Run <code>make</code> to build <code>k</code>, which you can then put into your <code>PATH</code>.
 
It also contains <code>repl.k</code>, which when run provides a convenient REPL environment for interactive programming. It's convenient to add a simple alias such as the following:
 
<syntaxhighlight lang="sh">
alias krepl='rlwrap k ~/sources/k/repl.k'
</syntaxhighlight>
 
== Building external libraries ==
Line 30 ⟶ 40:
[https://github.com/x86y/onikuruma onikuruma] is an implementation of the [https://github.com/kkos/oniguruma Oniguruma] regular expression library for K. It contains both the required C code and Makefile as examples of how to build K-compatible external libraries, as well as example K code for how to call an external library from K. A short example for reference:
 
<syntaxhighlight lang="cppk">
m:`"./libregex.so"2:(`match;2)
m["asd";"someasdstring"]
7

edits