>>  <<  Ndx  Usr  Pri  Phr  Dic  Rel  Voc  !:  wd  Help  Phrases

Hooks

A pair of functions in isolation form a hook whose monadic case is defined as in:

(= <.) y is equivalent to y = <. y

hence the function h=: =<. compares its argument with its integer part, and therefore provides a test for integers. Hooks occur frequently in most sections.

m0=: It=: =<. Integer test
m1=: Rt=: =+ Real test
v2=: $,: x copies of y
m3=: cf=: (+%)/ Continued fraction
m4=: cfc=: (+%)/\ Continued fraction convergents

For example:

  cf 3 7 15 1		Approximation to pi
3.14159

   cfc 3 7 15 1		Convergents to pi
3 3.14286 3.14151 3.14159	 

   cfc 1 1 1 1 1 1 1	Convergents to golden mean
1 2 1.5 1.66667 1.6 1.625 1.61538	

   cfc 10$1x		As above in extended precision
1 2 3r2 5r3 8r5 13r8 21r13 34r21 55r34 89r55

>>  <<  Ndx  Usr  Pri  Phr  Dic  Rel  Voc  !:  wd  Help  Phrases