GithubHelp home page GithubHelp logo

abrudz / dyalog_vision Goto Github PK

View Code? Open in Web Editor NEW
12.0 4.0 2.0 138 KB

A realistic future development for the core language of Dyalog APL

License: MIT License

Shell 2.31% APL 97.69%
dyalog-apl dyalog language-extensions polyfills

dyalog_vision's Introduction

Dyalog APL Vision

This is my vision for a realistic development of core Dyalog APL, including extending the domains of existing primitives/quad-names, and adding a few new ones. Requires and extends Dyalog APL version 18.2. If Dyalog APL moves forward in ways that are incompatible with what is found here, the vision will be updated accordingly. This project should therefore not be relied on as stable.

How to use

You can easily play with these almost like you use normal Dyalog APL in a session:

Initialisation

From within Dyalog APL 18.2 or higher, enter ]get path/dyalog_vision or to import directly from GitHub ]get https://github.com/abrudz/dyalog_vision

Running code

You have three options:

  1. Use the extensions directly with the glyph names, e.g. 4 1 dyalog_vision.RightShoeUnderbar ⎕A.
  2. Use dyalog_vision.∆FIX as a drop in for ⎕FIX.
  3. Use dyalog_vision.⍙REPL # to start a (limited) session where the glyphs work. Enter to exit.

Content

  • All scalar functions support leading axis agreement.

  • All set functions support arguments of any rank.

  • ⎕C and monadic ⎕UCS are scalar functions.

  • In addition, the following is included:

Name Symbol Type* Extension Examples
CircleDiaeresis 🔵 ✅ Depth when right operand is array. This is similar to Rank () but applies at nesting level. f⍥0 applies f like a scalar function and f⍥1 applies to flat subarrays. f⍤1⍥1 applies to flat vectors.
DelDiaeresis 🔺 Under (a.k.a. Dual). Like f⍥g but conceptually inverts the right operand when done. If g is a selection function, it puts the data back where it came from -⍢(2 3∘⊃) negates the 2nd element's 3rd element.
DelTilde 🔺 Obverse; ⍺⍺ but with inverse ⍵⍵ ×⍢(FFT⍫iFFT)
DollarSign $ 🔺 string enhancement ${1}:1⊃⍺, ${expr}:⍎expr, \n:JSON 'Dyer' 'Bob'$'Hi, ${2} ${1}!
$'Hi, ${first} ${last}!
$'2×3=${2×3}'
DownArrow 🔵 dyad allows long 0 1↓'abc' gives 1 2⍴'bc'
DownTack ⊥⍣¯1 when left argument is scalar 2⊤123 gives 1 1 1 1 0 1 1
EpsilonUnderbar 🔶 monad: Type (like  with ⎕ML←0) ⍷1'a'# gives 0' '#'
Equal = 🔶 monad: Rank (≢⍴) =10 20 30 gives 1'
GreaterOrEqual 🔵 monad: sort descending ≥3 1 4 1 5 gives 5 4 3 1 1
GreaterThan > 🔵 monad: Join >2 2⍴⍪¨1 2 3 4 gives 2 2⍴1 2 3 4
JotUnderbar 🔺 ✅ reverse composition X f⍛g Y is (f X) g Y and default argument ⌽⍛≡ checks for palindromes.
a-⍛↑b takes the last a from b.
LeftShoe 🔵 dyad allows partitioning along multiple leading axes (⊂1 1)⊂matrix separates out the first row and column.
LeftShoeUnderbar 🔵 dyad allows partitioning along multiple leading axes (⊂1 0 1 1)⊆4 4⍴⎕A splits off the first row and column, and removes the second.
LessOrEqual 🔵 monad: sort ascending ≤3 1 4 1 5 gives 1 1 3 4 5
LessThan < 🔵 monad: Major Cells <2 2 2⍴⎕A gives (2 2⍴'ABCD')(2 2⍴'EFGH')
QuadEqual 🔵 allow array operand to be vocabulary (then uses {⊂⍵} as internal operand) ≢¨'ACGT'⌸'ATT-ACA' gives 3 1 0 2
QuadDiamond 🔶 auto-extended ⍵⍵, allows small , optional edge spec(s) (0:Zero; 1:Repl; 2:Rev; 3:Mirror; 4:Wrap; -:Twist) with masks as operand's Life on a cylinder: 0 4 Life⌺3 3
QuestionMark ? 🔵 dyadic allows to be any shape (not just vector shape) and is shape of array to select indices from 3 5?4 13 deals 3 hands of 5 cards from deck of 4 suits from A to K
Rho 🔵 dyad: negatives reverse axis, 0.5 auto-size rounding down, 1.5 auto-size rounding up, 2.5 auto-size with padding Reshape into two columns: 0.5 2⍴data
RightShoeUnderbar 🔺 monad: last (⊃⌽,⍵)
✅ dyad: select (⌷⍨∘⊃⍨⍤0 99)
3 1 2⊇'abc' gives 'cab'
Root 🔺 (Square) Root √25 gives 5
3√27 gives 3
UpArrow 🔵 allows long 2 3↑4 5 gives 2 3⍴4 5 0 0 0 0
Vel 🔶 monad: demote (,[⍳2]) ∨2 3 4⍴⎕A gives 6 4⍴⎕A
Wedge 🔶 monad: promote (⍵⍴⍨1,⍴⍵) 'ABC'⍪⍥∧'DEF' gives 2 3⍴⎕A
∆EM ⎕EM 🔵 Self-inverse ⎕EM ⎕EM'RANK ERROR' 'WS FULL' gives 4 1
∆NG ⎕NG 🔺 Name Get ref⎕NG'Bea' 'Abe'
∆NS ⎕NS 🔵 Accepts ref left arg. Name Set: The list of values to copy into the new/target namespace can have 2-element name-value vectors, setting the name to the given value ref←⎕NS('Abe' 10)('Bea' 12)
ref⎕NS⊂'Carl' 8
∆NV ⎕NV 🔺 Names and Values `ref⎕NV -2 9
∆SIGNAL ⎕SIGNAL 🔵 Allows ⎕DMX-style ref argument ⎕SIGNAL ⎕DMX

* 🔺 new feature 🔶 added valence 🔵 expanded domain ⚠ breaking change ✅ scheduled for 20.0

dyalog_vision's People

Contributors

abrudz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

cchando xelxebar

dyalog_vision's Issues

thanks for not just commiting .dws files

it seems like Dyalog APLers like to pass around binary workspace files (oh i'm sure there is some great reason for this) but it is more friendly to newcomers to see the source files.
thanks for doing that.

Indexing with RightShoeUnderbar doesn't obey IO

When ⎕IO←0, indexing with is still behaving as if ⎕IO←1

      dyalog_vision.⍙REPL #
Dyalog APL/L-64 Version 18.2.45405
Serial No : 123456
Vision Edition
Thu Apr 11 18:55:33 2024
      13 2 424
1 2 3 4
5 6 7 8
      ⎕IO0
      13 2 424
0 1 2 3
4 5 6 7
      03 2 424
INDEX ERROR

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.