Hi John,

I would suggest looking at Henry Rich's "J for C Programmers" which
comes as part of any J installation. You can also get a PDF version and
in book form.

I'm suggesting this book because you don't really need to be a C
programmer to read it. He uses C as a counter-point but the discussions
and explanations can be easily understood by any math person. Actually,
I just treat the C codes as some text that I don't really need to read.
Hehehehe.

Also, I believe that the last 7 chapters of his book is under the
heading of "Tacit Programming". ;)

r/alex

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Saunders, John
(HEALTH)
Sent: Monday, September 01, 2008 9:30 AM
To: Programming forum
Subject: [Jprogramming] RE: Create Dyad ?

Thanks everyone for your very useful answers ; I've now halved my code
by replacing monads with dyads where appropriate.

I can see I've got a way to go in understanding the finer points of verb
composition esp when looking at Raul's proposed solution 
annmatch=: (i.>./)@((+/)@e.&>"0 1)

Raul in answer to your question no actually the output didn't need to be
boxed and the above definition works superbly ; though I'll need to
further understand this type of verb before I use it ; I'm guessing this
is what you call a tacit verb ? seems quicker than using 3 : 0 and 4 : 0
as well.

Cheers
John

-----Original Message-----
From: Sherlock, Ric [mailto:[EMAIL PROTECTED] 
Sent: Saturday, 30 August 2008 3:41 AM
To: Programming forum
Subject: [Jprogramming] RE: Create Dyad ?

---Saunders, John wrote:
>
> Hi guys I have the below verb annmatch and would like to make it a
dyad
> the noun bals is what I want to replace with an X value so I can make
> this more flexible and not tied to bals ; just not exactly sure how to
> go about it ; hope I'm making sense and using the appropriate j-
> language
> here.

In addition to the helpful advice already given, you might find the
following wiki page useful:
<http://www.jsoftware.com/jwiki/Guides/Defining_Verbs>

Note also (the following is a transcript from a J session)
   dyad    NB. this pre-defined when your session starts
4
   define  NB. so is this
 :0

NB. Therefore:
MyDyadicVerb=: dyad define
  x + y
)

Is equivalent to:
MyDyadicVerb=: 4 :0
  x + y
)

NB. Similarly:
MyMonadicVerb =: monad define
  2 * y
)

NB. is equivalent to:
MyMonadicVerb =: 3 :0
  2 * y
)

NB. It is less confusing to use "verb" instead of "monad" when
NB. defining a verb with both monadic and dyadic cases, although
NB. they are both just covers for 3:
  3 = monad , verb
1 1

MyVerb =: verb define
 2 * y
 :
 x + y
)


----------------------------------------------------------------------
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