At: Difference between revisions

From The K Language Wiki
Content added Content deleted
("Better category ordering, add redirects to categories, fix pseudo-adverb categories")
("Paragraph cleanup")
 
Line 8: Line 8:
(`a`b!0 1)`b
(`a`b!0 1)`b
1
1

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).



Latest revision as of 07:59, 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).