{"id":23194764,"url":"https://github.com/abrudz/apl-array-notation","last_synced_at":"2026-03-20T00:59:50.102Z","repository":{"id":90728509,"uuid":"147528275","full_name":"abrudz/apl-array-notation","owner":"abrudz","description":"A model for a literal notation for most APL arrays","archived":false,"fork":false,"pushed_at":"2020-02-07T12:38:04.000Z","size":26,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-05T07:43:23.144Z","etag":null,"topics":["apl","array","arrays","constant","constants","depth","dyalog","dyalog-apl","dyalogapl","literal","literals","multi-dimensional","multidimensional-arrays","namespaces","notation","rank"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abrudz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-05T14:09:30.000Z","updated_at":"2023-08-31T05:11:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"dc73ff93-0664-468b-9924-3c8d4e8d6f04","html_url":"https://github.com/abrudz/apl-array-notation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/abrudz/apl-array-notation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abrudz%2Fapl-array-notation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abrudz%2Fapl-array-notation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abrudz%2Fapl-array-notation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abrudz%2Fapl-array-notation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abrudz","download_url":"https://codeload.github.com/abrudz/apl-array-notation/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abrudz%2Fapl-array-notation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28574399,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T16:29:19.148Z","status":"ssl_error","status_checked_at":"2026-01-19T16:29:17.772Z","response_time":67,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apl","array","arrays","constant","constants","depth","dyalog","dyalog-apl","dyalogapl","literal","literals","multi-dimensional","multidimensional-arrays","namespaces","notation","rank"],"created_at":"2024-12-18T13:15:26.894Z","updated_at":"2026-01-19T16:33:09.404Z","avatar_url":"https://github.com/abrudz.png","language":null,"readme":"# A model for a literal notation for most APL arrays\n\n## How to use\n\nFirst load the library with `]load apl-array-notation/*`.\n\n### `Deserialise`\n\nThis takes a character array and evaluates it as array notation, returning the resulting array.\n\n```apl\nDeserialise '[1 2 ⋄ 3 4]'\nDeserialise '(a:{(+⌿⍵)÷≢⍵}' 'b:42)'\nDeserialise '(1 2 3',(⎕UCS 10),'4 5)'\n```\n\nAn optional left argument of `0` may be specified to return an APL expression which will generate the array rather than returning the array itself.\n\n### `Serialise`\n\nThis takes an array and returns a character vector of matrix representing the argument in array notation.\n\n```apl\nSerialise 2 2⍴⍳4\nSerialise ⎕fix ':namespace' 'a←{(+⌿⍵)÷≢⍵}' 'b←42' ':endnamespace'\nSerialise '(1 2 3)(4 5)'\n```\n\nAn optional left argument of `1` may be specified to force return of a vector by using `⋄` to fuse lines.\n\n### `∆NS`\n\nExtends `⎕NS` to allow a two-element right argument of names and values:\n\n```apl\nmyns←∆NS ('name1' 'name2')(7 42)\n'myns'∆NS ('name3' 'name4')('apl' 'dyalog')\n```\n\n### `∆NSinverse`\n\nTakes a ref or name of a namespace and returns a two-element vector of names and values.\n```\n∆NSinverse myns\n∆NSinverse 'myns'\n```\n\n### `Array`\n\nThis allows using the notation inline, optionally over multiple lines, without having to quote everything. Instead, the notation is encapsulated in a dfn, which is used as operand for `Array` which in turn returns the corresponding array. A right argument must be supplied, and may be `⍬` or `1` returns the array, while `0` returns an expression for the array.\n\n## Domain and Limitations\n\n### Valid Content\n\nThe models handle arrays consisting of numbers, characters, namespaces, one-liner dfns/dops, and such arrays. Note that namespaces lose their scripts, names, and system variables when serialised, just like when converted to JSON using `⎕JSON`. Classes, Instances, Interfaces, and namespaces are not supported. Namespaces with circular references will cause `Serialise` to recurse until `WS FULL`.\n\n### Functions and Operators\n\n`Serialise` does handle multi-line dfns/dops, but `Deserialise` is not able to parse them. Tradfns/tradops and derived functions/operators (including primitives and trains) are not supported.\n\n### Code Layout\n\n`Serialise` generates indented notation using line breaks, but will fall back to using diamonds for the inner parts of certain nested arrays. It will often generate superfluous parentheses and diamonds.\n\n### Scoping and Order of Evaluation\n\nThe official proposal for the below notation includes specification of exact scope in phrases, including order of evaluation. The models do not attempt to address this other than encapsulating namespace members such that names created as side effects avoid polluting their surroundings. This also means that a namespace cannot contain a member with a name identical to itself.\n\n### System Variables\n\n`Deserialise` does not accept invalid APL names as members of namespaces. This includes otherwise valid system names like `⎕IO` and `⎕ML`.\n\n## Notation\n\nThe notation extends strand notation as follows:\n\n### Round Parentheses\n\nA diamond (`⋄`) inside a parenthesis causes the parenthesis to represent a vector where each diamond-delimited phrase represents an element.  \n `(1 2 ⋄ 3 4 5)` is equivalent to `(1 2)(3 4 5)`\n\nA colon (`:`) inside a parenthesis causes the parenthesis to represent a namespace where each diamond-delimited phrase represents a name:value pair.  \n `(ans:42)` is equivalent to `⎕JSON'{\"ans\":42}'` (except for the display form)\n\nAn empty parenthesis (`()`) represents a new empty namespace.  \n `()` is equivalent to `⎕NS⍬`\n\n### Square Brackets\n\nA diamond (`⋄`) inside a bracket causes the bracket to represent an array where each diamond-delimited phrase represents a major cell.  \n `[1 2 3 ⋄ 4 5 6]` is equivalent to `2 3⍴1 2 3,4 5 6`\n\nIf a major cell is scalar, it will be interpreted as a 1-element vector.  \n `[1 ⋄ 2]` is equivalent to `⍪1 2`\n\nIf major cells have differing shapes, they will be extended in the manner of Mix (`↑`).  \n `[1 2 ⋄ 3 4 5]` is equivalent to `2 3⍴1 2 0,3 4 5`\n\n### Diamonds, Whitespace, Line Breaks\n\nAt least one diamond is required to indicate array notation as opposed to traditional parenthesisation or bracketing.  \n `(1)` is equivalent to `1`  \n `'abcdef'[[1 2 3 ⋄ 4 5 6]]` is equivalent to `'abcdef'[2 3⍴1 2 3,4 5 6]`\n\nAll-whitespace phrases are ignored.  \n `(1 2 ⋄ ⋄ 3 4 5)` is equivalent to `(1 2)(3 4 5)`  \n `(1 2 ⋄ )` is equivalent to `,⊂1 2`  \n `(1 ⋄ )` is equivalent to `,1`\n\nAny diamond may be exchanged with a line break.  \n `(1 2`   \n `3 4 5)`  is equivalent to `(1 2 ⋄ 3 4 5)`\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabrudz%2Fapl-array-notation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabrudz%2Fapl-array-notation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabrudz%2Fapl-array-notation/lists"}