Vocabulary/squarelf
>> << Down to: Dyad Back to: Vocabulary Thru to: Dictionary
[ y Same
Rank Infinity -- operates on x and y as a whole -- WHY IS THIS IMPORTANT?
Returns noun y unchanged: [y is equivalent to y.
z=: i.6 NB. try any noun here assert z -: [z
NOTE: Same (] y) is equivalent to ([ y)
Common uses
See Same (]), which is conventionally the one used in this role.
Related Primitives
Same (] y)
Use These Combinations
Combinations using [ y that have exceptionally good performance include:
What it does Type;
Precisions;
RanksSyntax Variants;
Restrictions
Benefits;
Bug Warnings
Extract substring/subarray table or list x ];.0 y or [;.0 avoids creating indexes Reshape infixes x ]\ y [ , in place of ]
x [ y Left
Rank Infinity -- operates on x and y as a whole -- WHY IS THIS IMPORTANT?
x=: 3 y=: 5 x [ y 3 assert x -: x [ y NB. try with any 2 nouns as x and y
Common uses
1. Separate two assignments on the same line
The right-hand phrase must evaluate to a noun, to represent a valid y for use in (x [ y).
p=: 3 [ q=: 5
2. In a dyadic tacit verb: bring in the value of argument x
13 : 'x+(x-y)*y' [ + - * ]
3. In a dyadic tacit verb: use u@[ to execute u on the x argument to a verb
3 (< , <) 'a' NB. No good: the , are executed as dyads |domain error 3 (<@[ , <@]) 'a' NB. Execute as monads on the appropriate argument +-+-+ |3|a| +-+-+
Related Primitives
Right (x ] y)
Use These Combinations
Combinations using [ y that have exceptionally good performance include:
What it does Type;
Precisions;
RanksSyntax Variants;
Restrictions
Benefits;
Bug Warnings
Extract substring/subarray table or list x ];.0 y or [;.0 avoids creating indexes Fetch from multiple index lists (each row of x is one index list into y) x (<"1@[ { ]) y avoids boxing x