GithubHelp home page GithubHelp logo

vmchale / apple Goto Github PK

View Code? Open in Web Editor NEW
51.0 3.0 1.0 1.5 MB

Apple array system

License: Other

Makefile 0.32% Haskell 68.28% C 2.48% Logos 2.55% Yacc 1.63% Vim Script 0.15% TeX 4.21% Python 0.47% Dhall 0.23% R 0.07% GDB 0.04% Jupyter Notebook 19.56% Perl 0.01%
array haskell

apple's Introduction

Apple Array System

Compiler-As-a-Library

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

Dimension As a Functor

This is based on J (and APL?). Looping is replaced by functoriality (rerank).

Installation

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.

Python

To install the Python module:

make install-py

R

Install libappler.so on your system like so:

make -C Rc
sudo make install-r

Then:

source("R/apple.R")

to access the functions.

Documentation

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.