Rather than an environment-based interpreter or a compiler invoked on the command line and generating object files, one calls a library function which returns assembly or machine code from a source string.
Thus the same implementation can be used interpreted, compiled, or called from another language.
> [((+)/x)%ℝ(:x)]\`7 (frange 1 10 10)
Arr (4) [4.0, 5.0, 6.0, 7.0]
>>> import apple
>>> import numpy as np
>>> apple.apple('([((+)/x)%(ℝ(:x))]\`7)',np.arange(0,10,dtype=np.float64))
array([3., 4., 5., 6.])
>>>
> source("R/apple.R")
> apple("([((+)/x)%ℝ(:x)]\\`7)",seq(0,10,1.0))
[1] 3 4 5 6 7
This is based on J (and APL?). Looping is replaced by functoriality (rerank).
Use ghcup to install cabal and GHC. Then:
make install
to install arepl
(the REPL).
Run
make
sudo make install-lib
To install the shared library.
To install the Python module:
make install-py
Install libappler.so
on your system like so:
make -C Rc
sudo make install-r
Then:
source("R/apple.R")
to access the functions.
Type \l
in the REPL to show the reference card:
> \l
Λ scan √ sqrt
⋉ max ⋊ min
⍳ integer range ⌊ floor
ℯ exp ⨳ {m,n} convolve
\~ successive application \`n dyadic infix
_. log 'n map
` zip `{i,j∘[k,l]} rank
𝒻 range (real) 𝜋 pi
_ negate : size
𝓉 dimension }.? last
->n select ** power
gen. generate 𝓕 fibonacci
re: repeat }. typesafe last
⊲ cons ⊳ snoc
^: iterate %. matmul
⊗ outer product |: transpose
{.? head {. typesafe head
}.? last }: typesafe init
⟨z,w⟩ array literal ?p,.e1,.e2 conditional
...
Enter :help
in REPL:
> :help
:help, :h Show this help
:ty <expression> Display the type of an expression
...