JPhrases/BondCurry

From J Wiki
Jump to: navigation, search

2A. Bond or Curry


Fixing an argument of a verb produces a monad. Some verbs so produced are sufficiently important to justify being denoted by a primitive symbol, and the following table often shows the corresponding primitive together with the English definition. The conjunction & (often called with) is used to bond an argument to a verb.

m0 =: 1&+ Increment >:
m1 =: +&1 "
m2 =: _1&+ Decrement <:
m3 =: -&1 "
m4 =: 1&- Not -. (logical and probability complement)
m5 =: 1&~: "
m6 =: 0&= "
m7 =: 0&- Negate - (arithmetic)
m8 =: _1&* "
m9 =: *&_1 "
m10=: 2&* Double +:
m11=: *&2 "
m12=: 3&* Triple
m13=: *&3 "
m14=: 0j1&* j. (Multiply by √-1)
m15=: ^@j. r. (Complex # on unit circle at y radians)
m16=: 1p1&* π times
m17=: 0.5&* Halve -:
m18=: *&0.5 "
m19=: %&2 "
m20=: 1&% Reciprocal %
m21=: ^&_1 "
m22=: ^&2 Square *:
m23=: ^&3 Cube
m24=: ^&0.5 Square root %:
m25=: ^&1r2 "
m26=: 2&%: "
m27=: ^&(%3) Cube root
m28=: ^&1r3 "
m29=: 3&%: "
m30=: (^1)&^ Exponential ^
m31=: 1x1&^ "
m32=: 1x1&^. Natural log ^.
m33=: 10&^ Antilog
m34=: 10&^. Base-10 log
m35=: >:@<.@(10&^.)@(1&>.) # of digits needed to represent integer y
m36=: #@(10&#.^:_1)"0 "
m37=: >:@<.@( 2&^.)@(1&>.) # of bits needed to represent integer y
m38=: #@( 2&#.^:_1)"0 "
m39=: 0&{ Head (first) {.
m40=: _1&{ Tail (last) {:
m41=: 1&}. Behead }.
m42=: _1&}. Curtail }:
m43=: 0&< Positive test
m44=: 0&> Negative test
m45=: 0&>. Max (0,y)
m46=: 0&<. Min (0,y)
m47=: (0&=)@(2&|) Even test
m48=: (1&=)@(2&|) Odd test
m49=: _1&A. Reverse |.
m50=: (<0 _1)&C. Interchange first and last items
m51=: <.@(0.5&+) Round
m52=: ,~ $ 1: , ] $ 0: Identity matrix of order y
m53=: -.@(' '&E.) # ] Remove multiple blanks
m54=: BC=: i.@>: ! ] Binomial coefficients of order y
m55=: (0&,+,&0)^:([ `1:) " (recursive)
m56=: BCT=:i. !/ i. BC table of orders to y-1
m57=: PAT=: |:@BCT Pascal’s triangle
m58=: (0&,+,&0)^:(i.`1:) " (recursive)
m59=: IX=: a.&i. Index in ASCII alphabet
m60=: Lt=:(1&e.)@(e.&a.)@, Literal test
m61=: 1&#. Sum over lists (last axis) +/"1
m62=: 1&, Preface a row of 1’s
m63=: ,&1 Append a row of 1’s
m64=: 1&,. Preface a column of 1’s
m65=: ,.&1 Append a column of 1’s
m66=: 1&,@$ $ , Itemize (append leading 1 to shape) ,:
m67=: sin=: 1&o. Sin
m68=: asin=: _1&o. Arcsin
m69=: cos=: 2&o. Cos
m70=: acos=: _2&o. Arccos
m71=: tan=: 3&o. Tan
m72=: atan=: _3&o. Arctan
m73=: sinh=: 5&o. Sinh
m74=: asinh=: _5&o. Arcsinh
m75=: cosh=: 6&o. Cosh
m76=: acosh=: _6&o. Arccosh
m77=: tanh=: 7&o. Tanh
m78=: atanh=: _7&o. Arctanh