The pure tacit form of CHAR is just a variation of Henry's suggestion:

   char=. &: (a.&i.)
   
   u char
u&:(a.&i.)

When it is invoked it renders an ambivalent verb.





 
Bayesian Efficient Strategic Trading LLC 
 
The information in this communication and any attachment is confidential and
intended solely for the attention and use of the named addressee(s). Any
views or opinions presented are solely those of the author and do not
necessarily represent those of Bayesian Efficient Strategic Trading, LLC
(BEST) unless otherwise specifically stated. All information and opinions
expressed herein are subject to change without notice. This communication is
not to be construed as an offer to sell or the solicitation of an offer to
buy any security. Any reliance one may place on the accuracy or validity of
this information is at their own risk. Past performance is not necessarily
indicative of the future results of an investment. BEST might be engaged, at
any time, in proprietary trading and hold a trading position (long or short)
that might or might not be consistent with the views expressed herein. If
you are not the intended recipient, or a person responsible for delivering
this to the intended recipient, you are not authorized to and must not
disclose, copy, distribute, or retain this message or any part of it. 


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:programming-
> [EMAIL PROTECTED] On Behalf Of Richard Donovan
> Sent: Wednesday, November 07, 2007 4:40 AM
> To: Programming forum
> Subject: RE: [Jprogramming] My first adverb - doesn't work!
> 
> 
> Mark this is great stuff and taught me a heck of a lot. Thanks!
> 
> Your adverb is EXACTLY what I wanted and works great for all verbs I
> have tried with it so far.
> 
> 
> 
> Your message was clear, precise, and easy to understand.
> 
> 
> 
> The one thing I didn't quite understand was why the final tacit
> version...
> 
> 
> 
> > NB. Final tacit form
> 
> > CHAR =: 1 : 'u &: (a.&i.)'
> 
> 
> 
> ...appears to be monadic, whereas the penultimate version...
> 
> > CHAR =: 1 : 0
> > :
> >   x (u &: (a.&i.)) y
> > )
> 
> ...is dyadic.
> 
> However I hope to understand that when I work my way thru your response
> again.
> 
> 
> 
> Have you contributed any other gems like this to the Wiki or elsewhere?
> If so, please let me know as I would be very keen to read them.
> 
> 
> 
> Thanks again,
> 
> 
> 
> Richard
> 
> > Date: Tue, 6 Nov 2007 02:05:10 -0700
> > From: [EMAIL PROTECTED]
> > To: [email protected]
> > Subject: Re: [Jprogramming] My first adverb - doesn't work!
> >
> > Richard Donovan <[EMAIL PROTECTED]> wrote:
> >
> > > CHAR =: 1  :0
> > > t1=: a.i.x
> > > t2=: a.i.y
> > > t1 u t2
> > > )
> > >
> > > but...
> > >
> > >    'z'> CHAR 'a'
> > > |domain error
> > > |   'z'   >CHAR'a'
> > >   t1
> > > 33
> > >    t2
> > > 97
> > >    t1{a.
> > > !
> > >    t2{a.
> > > a
> > >
> > > I am missing something obvious (again!)
> >
> > Adverbs and conjunctions can be used to make verbs in two ways:
> >
> > 1) They can immediately return tacit verbs, which are then invoked.
> >    This is the style used in several responses to your message.
> >    The bodies of such adverbs/conjunctions may use only the operator
> >    parameter names (m/u and/or n/v). They may not use the verb
> >    paramaters (x,y) since the verb is being returned to be executed
> >    later, but not executed at this time.
> >    (An obsolescent style is also supported, which uses only x and y
> >     are used; in this case, x and y are equivalent to u and v.)
> >
> > 2) They can include entire verb bodies which are executed each time.
> >    This style is invoked when you use both the operator parameters
> >    (m/u/n/v) and verb parameters (x/y).
> >    In this case, the verb may be ambivalent (just as with 3 : 0),
> >    with the monad part coming first, optoinally followed by an
> >    empty line containing a single : followed by the dyad part.
> >
> > In the example above, you defined an adverb that executes a
> > verb with a monadic part, but no dyadic part. As such, invoking
> > it dyadically yields a domain error.
> >
> > (This is a VERY common error - I find myself making it all the time!)
> >
> > If you want the result to be dyadic, do this:
> >
> > CHAR =: 1  :0
> > :
> >   t1=: a.i.x
> >   t2=: a.i.y
> >   t1 u t2
> > )
> >
> > The reason you got valid (and strange) results for t1 and t2 was
> > that your adverb body never got executed, and t1/t2 contained
> > garbage left over from things you had done previously.
> >
> > Something else you should consider when writing explicit verb
> > or operator definitions: in most cases, unless you have a very
> > good reason to do so, you should try to avoid using global
> > assignments (=:) as they produce side-effects and pollute
> > the namespace. For temporary variables you should use local
> > assignmetns (=.) whenever possible.
> >
> > One good reason to violate the above rule, however, is if you
> > are trying to debug something; sometimes saving the results from
> > each line in a verb in a global variable for subsequent
> > examination can often be less cumbersome than using the
> > debugging primitives.
> >
> > Once you learn to "think tacitly", you will be able to refactor
> > thinks like the above; For eaxmple:
> >
> > NB. Initial explicit form
> > CHAR =: 1 : 0
> > :
> >   t1 =. a.i.x
> >   t2 =. a.i.y
> >   t1 u t2
> > )
> >
> > NB. Use constants with monads
> > NB. k u y  ->  k&u y
> > CHAR =: 1 : 0
> > :
> >   t1 =. (a.&i.) x
> >   t2 =. (a.&i.) y
> >   t1 u t2
> > )
> >
> > NB. Eliminate temporaries
> > CHAR =: 1 : 0
> > :
> >   ((a.&i.) x) u ((a.&i.) y)
> > )
> >
> > NB. Factor common sub-expressions by using bonding conjunctions or
> trains:
> > NB. (If v has infinite rank, the conjunctions & &. and @ are
> equivalent to &: &.: and @:)
> > NB. In this case: v = a.&i. so (v x) u (v  y) -> x u&:v y
> > NB. These other patterns are also commonly used:
> > NB. u (v y)  ->  u@:v y  or  u&:v y  or  ([: u v) y
> > NB. v^:_1 (u (v y))  ->  u&.:v y
> > NB. v^:_1 ((v x) u (v y))  ->  x u&.:v y
> > NB. u (x v y)  ->  x u@:v y
> > NB. (x u y) v (x w y)  ->  x (u v w) y
> > NB. (u y) v (w y)  ->  x (u v w) y
> > NB. x u (v y)  ->  x (u v) y
> > NB. y u (v y)  ->  (u v) y
> > CHAR =: 1 : 0
> > :
> >   x (u &: (a.&i.)) y
> > )
> >
> > NB. Final tacit form
> > CHAR =: 1 : 'u &: (a.&i.)'
> >
> > -- Mark D. Niemiec <[EMAIL PROTECTED]>
> >
> > ---------------------------------------------------------------------
> -
> > For information about J forums see
> http://www.jsoftware.com/forums.htm
> 
> _________________________________________________________________
> 100's of Music vouchers to be won with MSN Music
> https://www.musicmashup.co.uk------------------------------------------
> ----------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to