Vocabulary/starco

From J Wiki
Jump to navigation Jump to search

>> <<   Down to: Dyad   Back to: Vocabulary Thru to: Dictionary

*: y Square

Rank 0 -- operates on individual atoms of y, producing a result of the same shape -- WHY IS THIS IMPORTANT?


Equivalent to y ^ 2, the square of numeric noun y.

   *: 7
49

Common Uses

Can lead to neater tacit expressions

    pythag=: +&.*:   NB. instead of: ((x^2) + (y^2))^0.5
    3 pythag 4
5

More Information

Square video

Related Primitives

Double (+: y), Halve (-: y), Square Root (%: y)


x *: y Not-And

Rank 0 0 -- operates on individual atoms of x and y, producing a result of the same shape -- WHY IS THIS IMPORTANT?


The logical operation Not-And between two Boolean nouns x and y, which is false (0) if x and y are both true (1).

in other words, the same as -. x *. y

   0 0 1 1 *: 0 1 0 1
1 1 1 0
   (0 1) *:/ (0 1)      NB. Truth-table of: *:
1 1
1 0
   (0 1) *:table (0 1)  NB. Truth-table with borders
+--+---+
|*:|0 1|
+--+---+
|0 |1 1|
|1 |1 0|
+--+---+

Note: *: is restricted to Boolean arguments:

   1 *: 2
|domain error
|   1    *:2

More Information

NotAnd video

Related Primitives

Or (x +. y), Not-Or (x +: y), LCM (And) (x *. y), Not (-. y), Boolean Functions (m b.)