On Fri, Jun 29, 2012 at 1:50 PM, Ian Clark <earthspo...@gmail.com> wrote:
> And if you define your verb using (4 : 0) instead of (3 : 0) then it
> needs 2 arguments: one on either side of the word: 'humbug'. Otherwise
> you get:
>
> |domain error: humbug

I think an important thing to keep in mind here, is that every verb
has two definitions (for 1 and 2 arguments) along with a rank (which
also treats both cases).

A simple 3 :0 definition will supply an empty definition for the 2
argument case, and a 4 :0 definition will supply an empty definition
for the 1 argument case.

However, you can use ':' on a line by itself to end a 3 :0 single
argument definition and begin its two argument definition.

example1=: 3 :0
  'this is the one argument definition'
:
  'this is the two argument definition'
)

example2=: 3 :('1';':';'2')

Try these:

   example1 0
   example2 0
   0 example1 0
   0 example2 0
   example1("0) 1 2 3

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

Reply via email to