g=: [: [EMAIL PROTECTED] [: /:~@":"0 (>:i.6) * ] g 142857 1 g 142857142857x 1 g ". 'x' ,~ , (?1000) $ ,: '142857' 1
----- Original Message ----- From: Roger Hui <[EMAIL PROTECTED]> Date: Tuesday, March 20, 2007 3:08 am Subject: Re: [Jprogramming] monad vs. dyad > Cute. 142857 is immediately recognizable to me as > the decimal expansion of %7 . > > 1. The dyad =/ is the function table for = . > The monad =/ inserts = between items of the > argument. Thus =/1 4 2 8 5 7 is 1=4=2=8=5=7 which, > because of the right-to-left evaluation and because > x=y is 0 or 1, does not mean the same as it does > in conventional math notation. > > 2. The left-hand-side of assignment must be a name > or a string satisfying certain conditions. > > 4. The "capped fork" [: f g is the same as f@:g . > > 3. Yes, for example: > >: ^: (1 < [: [EMAIL PROTECTED] [: /:~@":"0 (>:i.6) * ]) ^: _ ] 1 > 142857 > > f^:proposition^:_ y is a common construct, meaning > z=. y > while. proposition y do. z=. f z end. > > > > ----- Original Message ----- > From: Geoff Canyon <[EMAIL PROTECTED]> > Date: Tuesday, March 20, 2007 1:15 am > Subject: Re: [Jprogramming] monad vs. dyad > > > Thanks for the help! > > > > 0 is the obvious answer, but there are other numbers that meet > > this > > criteria. > > > > I modified your code like this: > > > > f=:((1<])#@:~.@:(/:~@:":"0)@:((>:i.6)*]))+] > > (f^:_) 1 > > > > And got my answer. This leaves me with the following questions: > > > > 1. So what _does_ =/ mean? > > 2. If it doesn't mean anything, is it possible for me (any user) > > to > > define =/=:1&=#] ? (apparently not) > > 3. Is there a way to compose my two lines above into a single > command?> 4. To avoid all the @: above, should I be looking for > ways to turn > > it > > into forks and/or hooks? > > > > I have to add: my brain hurts! (in a good way) ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
