The exclusion of tautologies as "a bit meta" points
to the definition of "natural" as "what John is used to" ;-)

It not surprising that [ and ] etc. occur often in forks,
because many functions are not symmetric wrt the
left and right arguments.  For example, suppose
you want to model x|.y where x is a single number.
You'd expect the function to treat x and y differently,
and for that different treatment it'd have to first select
x and select y .  Thus:

   rot=: ] {~ #...@] | (+ i...@#@])
   3 rot 'abcdefghij'
defghijabc
   _2 rot 'abcdefghij'
ijabcdefgh

To find examples of the required forks, look for functions
that are symmetric (commutative).



----- Original Message -----
From: John Randall <[email protected]>
Date: Wednesday, February 4, 2009 5:31
Subject: Re: [Jprogramming] Examples of dyadic forks
To: Programming forum <[email protected]>

> Tracy Harms wrote:
> 
> > [: would also be excluded; I'm sure John left it out only as 
> an oversight.
> >
> > What John's looking for, I think, are "natural" examples where the
> > dyadic fork applies.
> 
> This is right on the money.  It is very easy to come up 
> with monadic
> forks.  Most dyadic forks seem degenerate, in that one of 
> the tines is
> only applied to one argument.  For example:
> 
> cap=:e. # [
> 
>    1 2 3 4 cap 4 3 5 6
> 3 4
> 
> This is the intersection of two lists, in the order of the 
> LHA.  The fork
> is of the form (x f y ) g (y).
> 
> The verb proj defines the projection of y onto x:
> 
> mp=:+/ .*
> norm=:[: %: mp~
> proj=:mp % n...@[
> 
>    3 4 proj 1 1
> 1.4
> 
> Here proj has the form (x f y) g (h x).
> 
> What I was trying to get at is that most dyadic forks one can 
> think of do
> not use the full generality (x f y) g (x h y), and I was seeking 
> "natural"examples which do.
> 
> Best wishes,
> 
> John
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to