Depending on the definition of "nontrivial", 3 more examples:

   range=: >. - <.
   5 range 8
3
   5 range _8.2
13.2

   equal=: >. = <.
   3 equal 4
0
   3 equal _5.1 3 400.5
0 1 0

   sgn=: > - <
   3 sgn 4
_1
   3 sgn 3
0
   3 sgn _2
1

x sgn y is _1, 0, or 1, depending on whether x is less than,
equal to, or greater than y.  The monad * on real arguments
is sgn&0 .



----- Original Message -----
From: Roger Hui <[email protected]>
Date: Sunday, February 1, 2009 19:39
Subject: Re: [Jprogramming] Examples of dyadic forks
To: Programming forum <[email protected]>

> The following expresses the tautology that
> ((x^2)-y^2) = (x+y)*(x-y) :
> 
>    diffsq=: -&*: = + * -
>    x=: 0.001 * _1e9 + 10 ?...@$ 2e9
>    y=: 0.001 * _1e9 + 10 ?...@$ 2e9
>    x diffsq y
> 1 1 1 1 1 1 1 1 1 1
> 
> Your question brings to mind events in the early days of J.  
> For a time Ken wondered, are there many examples of fork?  
> After a while, it seemed that _everything_ was a fork.
> http://keiapl.org/rhui/remember.htm#fork3
> 
> 
> 
> ----- Original Message -----
> From: John Randall <[email protected]>
> Date: Sunday, February 1, 2009 15:21
> Subject: [Jprogramming] Examples of dyadic forks
> To: JProgramming <[email protected]>
> 
> > Does anyone have a good example of a dyadic fork?  By this 
> > I mean one
> > of the form fgh where f and g both use x and y, there are no [ 
> > or ],
> > no constant functions, and no @ or @: .  I am having 
> > trouble coming up
> > with nontrivial examples.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to