Essays/Reflexive

From J Wiki
Jump to: navigation, search

The monad f~ y is defined to be y f y . Such usage also occurs in natural languages, for example self-made billionaire in English or je m'appelle Roger in French. The following are some examples of the reflexive:

 +~ double
 *~ square
 /:~ sort
 ?~ n random permutation of order n
 p}~i.#p the inverse of permutation p
 i.~ a more efficient form of self-classify; see Index in Nub
 {./.~ nub
 #/.~ frequencies corresponding to the nub; see Histogram
 i.@# = i.~ nub sieve (the monad ~:)
 i.~ = i:~ nub sieve
 #~ i.~ = i:~ unique items (nub)
 i.&>~@[ i.&|: i.&> index-of for an inverted table
 i.&>~ e.&|: i.&>~@] member-of for an inverted table
 ~:@|:@:(i.&>)~ nub sieve for an inverted table
 f/~ function table
 =/~ n$0 1 n by n checkerboard
 >:@#.~/.~&.q: sum of divisors
 (f g) y ↔ y (f g) y ↔ (f g)~ y
 fib=: 3 : 0 " 0

  mp=. +/ .*
  {.{: mp/ mp~^:(I.|.#:y) 2 2$0 1 1 1x
 )

the i-th Fibonacci number
 stdarg =: i.@{:@$ , ,:^:(1: -: #@$)

 pvp =: ~. @ (,/) @ ({"1/~)
 subgroup=: pvp^:_ @ stdarg

subgroup generated by a set of permutations;

see Symmetric Array
 



Contributed by Roger Hui.