Ngn/apl: Difference between revisions

Jump to navigation Jump to search
3,080 bytes added ,  12:25, 31 August 2023
Link removed
Miraheze>Marshall
mNo edit summary
(Link removed)
 
(42 intermediate revisions by 9 users not shown)
Line 1: Line 1:
{{Infobox array language
{{DISPLAYTITLE:ngn/apl}}{{Infobox array language
| logo                    = [[File:Ngn-apl logo.png]]
| title                    = ngn/apl
| array model              = [[nested array model|nested]]
| array model              = [[nested array model|nested]]
| index origin            = 0
| index origin            = 0
| function styles          = [[dfn]], [[tacit]]
| function styles          = [[dfn]], [[tacit]]
| numeric types            = complex floats
| numeric types            = [[complex]] floats
| unicode support          = full
| unicode support          = full
| released                = 2011
| released                = 2011
| developer                = Nick Nickolov
| developer                = Nick Nickolov
| latest release version  = 2018 (unversioned)
| latest release version  = 2018 (unversioned)
| implementation languages = [https://en.wikipedia.org/wiki/Javascript Javascript]
| implementation language  = [[wikipedia:Javascript|Javascript]]
| platforms                = In-browser, [https://en.wikipedia.org/wiki/Node.js NodeJS]
| source                  = [https://github.com/abrudz/ngn-apl/ GitHub]
| license                  = [https://en.wikipedia.org/wiki/MIT_License MIT]
| platforms                = In-browser, [[wikipedia:Node.js|Node.js]]
| website                  = [https://gitlab.com/n9n/apl gitlab.com/n9n/apl]
| license                  = [[wikipedia:MIT_License|MIT]]
| website                  = [https://github.com/abrudz/ngn-apl/ github.com/abrudz/ngn-apl]
| influenced by            = [[Dyalog APL]]
| influenced by            = [[Dyalog APL]]
| run online              = [https://abrudz.github.io/ngn-apl/web/ In-browser]
}}
}}
'''ngn/apl''' is an APL bytecode compiler and interpreter by Nick Nickolov. Because it is implemented in [[wikipedia:Javascript|Javascript]], it can be run in [[wikipedia:Node.js|Node.js]] or any modern browser.


:''For technical reasons, this page is named "Ngn/apl". The actual name of the implementation is "ngn/apl".''
On December 27, 2020, Nickolov announced that he would discard his implementation.<ref>Nickolov, N. "ngn". [https://chat.stackexchange.com/transcript/message/56558504#56558504 Announcement]. [[APL Orchard]]. Stack Exchange chat.</ref> Soon after, [[Adám Brudzewsky]] took up the mantle of hosting the source and online demo.<ref>Brudzewsky, A. "Adám". [https://chat.stackexchange.com/transcript/message/56558600#56558600 Announcement]. [[APL Orchard]]. Stack Exchange chat.</ref>
[[File:Ngn/apl|center|thumb|ngn/apl's [https://abrudz.github.io/ngn-apl/web/ demo interface]]]


An APL interpreter written in JavaScript by Nick Nickolov. It can run in a browser or on NodeJS.
== Features ==


ngn/apl supports most primitives, dfns (<code>{⍺ ⍵}</code>), nested arrays, complex numbers (<code>1j2</code>), infinities (<code>¯</code> or <code>∞</code>), [[forks and atops|Trains]], strand assignment (<code>(a b)←c</code>), indexed assignment (<code>a[b]←c</code>), user-defined operators (<code>{⍺⍺ ⍵⍵}</code>), but does not support tradfns (<code>∇R←X f Y</code>), non-zero index origin (<code>⎕IO</code>), comparison tolerance (<code>⎕CT</code>), prototypes, [[modified assignment]] (<code>x+←1</code>), [[control structures|Keywords]] (<code>:If</code>), [[object-oriented features|Object orientated programming]], namespaces.
ngn/apl partially supports some of the core language of [[Dyalog APL 14.0]]:
* [[dfn]]s (<syntaxhighlight lang=apl inline>{⍺ ⍵}</syntaxhighlight>)
* [[nested array]]s
* [[complex number]]s (<syntaxhighlight lang=apl inline>1j2</syntaxhighlight>)
* [[Function train|forks and atops]]
* [[Multiple assignment|strand assignment]] (<syntaxhighlight lang=apl inline>(a b)←c</syntaxhighlight>)
* [[indexed assignment]] (<syntaxhighlight lang=apl inline>a[b]←c</syntaxhighlight>)
* [[dop|user-defined operators]] (<syntaxhighlight lang=apl inline>{⍺⍺ ⍵⍵}</syntaxhighlight>), using the <syntaxhighlight lang=apl inline></syntaxhighlight> and <syntaxhighlight lang=apl inline></syntaxhighlight> glyphs in place of Dyalog's <syntaxhighlight lang=apl inline>⍺⍺</syntaxhighlight> and <syntaxhighlight lang=apl inline>⍵⍵</syntaxhighlight>.


== External link ==
The following features of Dyalog APL are not supported:
* <syntaxhighlight lang=apl inline>!</syntaxhighlight> does not work with negative or complex operands.
* [[Where]] (<syntaxhighlight lang=apl inline>⍸</syntaxhighlight>)
* [[Over]] (<syntaxhighlight lang=apl inline>⍥</syntaxhighlight>)
* [[Atop]] (<syntaxhighlight lang=apl inline>⍤</syntaxhighlight>)
* [[Nest]] (<syntaxhighlight lang=apl inline>⊆</syntaxhighlight>)
* [[Partitioned enclose]] (<syntaxhighlight lang=apl inline>⊆</syntaxhighlight>)
* [[At]] (<syntaxhighlight lang=apl inline>@</syntaxhighlight>)
* [[Stencil]] (<syntaxhighlight lang=apl inline>⌺</syntaxhighlight>)
* [[Unique mask]] (<syntaxhighlight lang=apl inline>≠</syntaxhighlight>)
* [[Key]] (<syntaxhighlight lang=apl inline>⌸</syntaxhighlight>)
* [[Rank (operator)|Rank (operator]] (<syntaxhighlight lang=apl inline>⍤</syntaxhighlight>)
* [[tradfn]]s (<syntaxhighlight lang=apl inline>∇R←X f Y</syntaxhighlight>)
* non-zero [[index origin]] (<syntaxhighlight lang=apl inline>⎕IO←1</syntaxhighlight>)
* [[comparison tolerance]] (<syntaxhighlight lang=apl inline>⎕CT</syntaxhighlight>)
* [[prototype]]s (it always uses zero as fill)
* [[modified assignment]] (<syntaxhighlight lang=apl inline>x+←1</syntaxhighlight>)
* [[keyword]]s (<syntaxhighlight lang=apl inline>:If</syntaxhighlight>)
* [[object-oriented programming]]
* [[namespace]]s.
* inverses.


* [https://n9n.gitlab.io/apl/web/index.html Online demo]
It extends Dyalog APL with:
* [[Infinity|infinities]] (<syntaxhighlight lang=apl inline>¯</syntaxhighlight> or <syntaxhighlight lang=apl inline>∞</syntaxhighlight>)
* the identity element operator (<syntaxhighlight lang=apl inline>⍁</syntaxhighlight>)
* exceptions (<syntaxhighlight lang=apl inline>↗</syntaxhighlight>)
 
== External links ==
* [http://archive.vector.org.uk/art10501160 ''Compiling APL to JavaScript''] article in the [[Vector journal]]
* [https://repl.it/languages/APL ngn/apl on REPL]
* [https://tio.run/#apl-ngn ngn/APL on Try It Online]
* [https://abrudz.github.io/ngn-apl/web/ Online demo]
* [https://plj541.github.io/APL.js/ Online session]
* [https://plj541.github.io/APL.js/ Online session]
* [https://repl.it/languages/APL Online REPL]
* [https://github.com/abrudz/ngn-apl/ Source code]
* [https://tio.run/#apl-ngn Try It Online]
== References ==
* [https://gitlab.com/n9n/apl Source code]
<references/>
 
{{APL dialects}}[[Category:APL dialects]][[Category:Nested array languages]][[Category:Leading axis languages]][[Category:Languages with tacit programming]][[Category:IR compilers]]
{{APL programming language}}

Navigation menu