Help / Phrases / 2. C. Ambivalent Functions

From J Wiki
Jump to navigation Jump to search


>> << Pri JfC LJ Phr Dic Voc !: Rel NuVoc wd Help Phrases


2C. Ambivalent Functions

The phrase h=: f : g defines h as the function whose monadic case is f and whose dyadic case is g . The components f and g may be functions already defined and named, or they may be tacit or explicit phrases. Moreover, either (but not both) may be defined in terms of the other by using $: for self-reference in a tacit definition.

v0=: 10&^. : ^. Base 10 log for monadic case
v1=: 10&$: : ^. Same using self-reference to dyad
v2=: 10&^. : ($:@] * ^.@(10"0) % ^.@[) Same using self-reference to monad
d3=: res=: [: : | Domain of monad is empty (dyadic only)
m4=: abs=: | : [: Domain of dyad is empty (monadic only)




>> << Pri JfC LJ Phr Dic Voc !: Rel NuVoc wd Help Phrases