Klong: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(9 intermediate revisions by 2 users not shown) | |||
Line 8: | Line 8: | ||
| file ext = .kg | | file ext = .kg | ||
| developer = Nils M Holm | | developer = Nils M Holm | ||
| latest release version = | | latest release version = 2022-12-12 | ||
| implementation language = [[wikipedia:C_(programming_language)|C]] ([[wikipedia:C99|C99]]) | | implementation language = [[wikipedia:C_(programming_language)|C]] ([[wikipedia:C99|C99]]) | ||
| platforms = Unix, [[wikipedia:Plan 9 from Bell Labs|Plan 9]] | | platforms = Unix, [[wikipedia:Plan 9 from Bell Labs|Plan 9]] | ||
Line 17: | Line 17: | ||
| influenced by = [[K]], [[wikipedia:Lisp (programming language)|Lisp]] | | influenced by = [[K]], [[wikipedia:Lisp (programming language)|Lisp]] | ||
}} | }} | ||
'''Klong''' is a language based on [[K]] (probably K3) which removes K's syntactic ambiguity and much of its overloading by using more digraphs ([[ | '''Klong''' is a language based on [[K]] (probably K3) which removes K's syntactic ambiguity and much of its overloading by using more digraphs ([[primitive function]]s and [[primitive operator|operators]] composed of two characters) to separate extra meanings. The removal of syntactic ambiguity means Klong has a [[wikipedia:context-free grammar|context-free grammar]]. | ||
== KlongPy == | |||
[https://github.com/briangu/klongpy KlongPy] is an independent, compatible implementation of Klong in [[wikipedia:NumPy|NumPy]]. It can be closely integrated with Python due to its use of NumPy arrays, and can be run on the GPU using [[wikipedia:CuPy|CuPy]] in place of standard NumPy. | |||
== Primitives == | == Primitives == | ||
Line 52: | Line 56: | ||
| <code>></code> || [[Grade-Down]] || [[More]] | | <code>></code> || [[Grade-Down]] || [[More]] | ||
|- | |- | ||
| <code>=</code> || [[Group]] || [[Equal]] | | <code>=</code> || [[Group (K)|Group]] || [[Equal]] | ||
|- | |- | ||
| <code>~</code> || [[Not]] || [[Match]] | | <code>~</code> || [[Not]] || [[Match]] | ||
|- | |- | ||
| <code>@</code> || | | <code>@</code> || Atom || [[Index function|Index]]/Apply | ||
|- | |- | ||
| <code>:@</code> || || Index-in-Depth | | <code>:@</code> || || Index-in-Depth | ||
|- | |- | ||
| <code>?</code> || [[ | | <code>?</code> || Range ([[Unique]]) || [[Find]] | ||
|- | |- | ||
| <code>,</code> || List (like [[Enclose]]) || [[ | | <code>,</code> || List (like [[Enclose]]) || Join (like [[Catenate]]) | ||
|- | |- | ||
| <code>_</code> || [[Floor]] || [[Drop]] | | <code>_</code> || [[Floor]] || [[Drop]] | ||
Line 122: | Line 126: | ||
* [http://t3x.org/klong/klong-vs-k.txt.html Differences from K] | * [http://t3x.org/klong/klong-vs-k.txt.html Differences from K] | ||
{{APL dialects}} | {{APL dialects}}[[Category:K dialects]][[Category:IR compilers]] |
Latest revision as of 20:15, 31 January 2024
Klong is a language based on K (probably K3) which removes K's syntactic ambiguity and much of its overloading by using more digraphs (primitive functions and operators composed of two characters) to separate extra meanings. The removal of syntactic ambiguity means Klong has a context-free grammar.
KlongPy
KlongPy is an independent, compatible implementation of Klong in NumPy. It can be closely integrated with Python due to its use of NumPy arrays, and can be run on the GPU using CuPy in place of standard NumPy.
Primitives
Klong documentation refers to primitive functions ("verbs" in K) as "operators".
Operator | Monadic | Dyadic |
---|---|---|
+ |
Transpose | Plus |
- |
Negate | Minus |
* |
First | Times |
% |
Reciprocal | Divide |
:% |
Integer-Divide | |
| |
Reverse | Max/Or |
:+ |
Rotate | |
& |
Expand/Where | Min/And |
^ |
Shape | Power |
:^ |
Reshape | |
! |
Enumerate | Remainder |
< |
Grade-Up | Less |
> |
Grade-Down | More |
= |
Group | Equal |
~ |
Not | Match |
@ |
Atom | Index/Apply |
:@ |
Index-in-Depth | |
? |
Range (Unique) | Find |
, |
List (like Enclose) | Join (like Catenate) |
_ |
Floor | Drop |
:_ |
Undefined | Cut |
:# |
Char | Split (Partition by lengths) |
# |
Size | Take |
$ |
Format | Format2 |
:= |
Amend | |
:- |
Amend-in-Depth | |
:: |
Define | |
:$ |
Form |
Adverb | Definition |
---|---|
f'a |
Each |
a f'b |
Each2 |
a f:\b |
Each-Left |
a f:/b |
Each-Right |
f:'b |
Each-Pair |
f/a |
Over |
a f/b |
Over-Neutral |
f:~a |
Converge |
a f:~b |
While |
a f:*b |
Iterate |
f\a |
Scan-Over |
a f\b |
Scan-Over-Neutral |
f\~a |
Scan-Converging |
a f\~a |
Scan-While |
a f\*a |
Scan-Iterating |
External links
APL dialects [edit] | |
---|---|
Maintained | APL+Win ∙ APL2 ∙ APL64 ∙ APL\iv ∙ Aplette ∙ April ∙ Co-dfns ∙ Dyalog APL ∙ Dyalog APL Vision ∙ dzaima/APL ∙ GNU APL ∙ Kap ∙ NARS2000 ∙ Pometo ∙ TinyAPL |
Historical | A Programming Language ∙ A+ (A) ∙ APL# ∙ APL2C ∙ APL\360 ∙ APL/700 ∙ APL\1130 ∙ APL\3000 ∙ APL.68000 ∙ APL*PLUS ∙ APL.jl ∙ APL.SV ∙ APLX ∙ Extended Dyalog APL ∙ Iverson notation ∙ IVSYS/7090 ∙ NARS ∙ ngn/apl ∙ openAPL ∙ Operators and Functions ∙ PAT ∙ Rowan ∙ SAX ∙ SHARP APL ∙ Rationalized APL ∙ VisualAPL (APLNext) ∙ VS APL ∙ York APL |
Derivatives | AHPL ∙ BQN ∙ CoSy ∙ ELI ∙ Glee ∙ I ∙ Ivy ∙ J ∙ Jelly ∙ K (Goal, Klong, Q) ∙ KamilaLisp ∙ Lang5 ∙ Lil ∙ Nial ∙ RAD ∙ Uiua |
Overviews | Comparison of APL dialects ∙ Timeline of array languages ∙ Timeline of influential array languages ∙ Family tree of array languages |