At: Difference between revisions

From The K Language Wiki
Content added Content deleted
("Add all appropriate categories to each verb")
("Better category ordering, add redirects to categories, fix pseudo-adverb categories")
Line 10: Line 10:
If <code>y</code> is an atom not in the domain of <code>x</code>, at returns the [[null?|null value]] for <code>x</code>'s type (except in kona).
If <code>y</code> is an atom not in the domain of <code>x</code>, at returns the [[null?|null value]] for <code>x</code>'s type (except in kona).


[[Category:Operator verbs]]
[[Category:Verbs]]
[[Category:Verbs]]
[[Category:Operator verbs]]
[[Category:Primitives]]
[[Category:Primitives]]

Revision as of 06:14, 9 July 2022

At
x@y

at is a primitive that unifies list indexing, function application, and dictionary lookup into a single concept. Syntactically, it can be expressed in three equivalent ways: x@y (using @ as a verb), x y (juxtaposition of nouns), and x[y] (M-expression).

 "abc"[1]
"b"
 {1+2*x}@3
7
 (`a`b!0 1)`b
1

If y is an atom not in the domain of x, at returns the null value for x's type (except in kona).