💾 Archived View for compudanzas.net › k.gmi captured on 2022-01-08 at 13:50:02. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-03)

➡️ Next capture (2022-03-01)

-=-=-=-=-=-=-

k programming language

a flavor of apl, i understand?

apl

resources

ngn/k

ngn/k online

notes from eris' k class

operator precedence: always from right to left.

types:

lists are enclosed between parenthesis, and items separated with semicolons

(1;2;3)
("a";"b";"c")

equivalent to:

1 2 3
"abc"

assignment is done with :

a: 1
b: 1 2 3

verbs

minus sign (-), unary is negate, binary is subtraction:

- 1 2 3
result -1 -2 -3

2 - 1
result 1

plus sign (+), binary is addition:

1 + 2
result 3

asterisk (*), unary is "first", binary is multiplication

2 * 3
result 6


result 3

vertical bar (|), unary is reverse, binary is mod?

|1 2 3
result 3 2 1

with colon (:) one can force the use of the unary mode, e.g.


exclamation mark (!) applied to an integer produces the natural numbers from 0 to that integer minus one:

!5
result 0 1 2 3 4

percent sign (%) is division

incoming links

apl

most recent update on: 12021-11-03

source file

compudanzas home

text, images, and code are shared with the peer production license