Skip to content

y-moriguchi/morilib-apl

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

Morilib APL

Morilib APL is an APL interpreter written by JavaScript.

How to use

Write the script tag in your Web site.

<script src="kanapl.js"></script>

To create APL environment, call KANAPL function.

var aplenv = KANAPL();

APL environment has two methods.

aplenv.eval()

Evaluate the given APL program and return evaluated array or scalar.

var result = aplenv.eval("3÷2 2ρ1 2 3 4");

aplenv.put()

Bind the given array or scalar.
The array is validated and throws an error if the array is not valid.

aplenv.put("A", [1, 2, 3, 4]);

Variable name

The characters shown as follows are vaild for variable name.

  • Uppercase ASCII alphabets
  • Kanji (Hanzi)
  • Hiragana
  • Katakana
  • Full width alphabets (Uppercase and Lowercase)
  • Half width Katakana

APL characters

Morilib APL can use below APL features.
Morilib APL also can use ASCII sequence surrounded by #.

Feature APL Morilib APL Sequence
Negative sign #~#
Addition + +
Subtraction - -
Multiplication × × #*#
Division ÷ ÷ #/#
Modulo/Absolute | |
Maximum/ceiling #max#
Minimum/floor #min
Power/Exponent #**#
Logarithm #log#
Random ? ?
Pi/Trigonometric Function #tri#
Factorial/Combination ! !
Logical Not #not#
Logical And #and#
Logical Or #or#
Logical Nand #nand#
Logical Nor #nor#
Reduce / /
Scan/Expand ||
Inner product . .
Outer product ∘. ・. #outer#
Shape/Reshape ρ ρ #rho#
Concatenate , ,
Take #take#
Drop #drop#
Reverse/Rotate φ(Phi) #rotate#
Transpose #transpose#
Index generator ι ι #iota#
Member of ∈ ε #in#
Sort(ascending) ♯(Sharp) #asc#
Sort(descending) #desc#
Inverse Matrix/Division Matrix #domino#
Encode #encode#
Decode #decode#
Execute #eval#
Format #tostring#
Assign #<-#

Limitation

  • User defined function and jump is not avaiable.
  • All elements of array must be numbers or characters. (Mixed array is not available)
  • All length of array in another array must be the same.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published