MAIN =: 4 : 0
'a b' =: y
VERB =: (<x)`:6
a VERB b
)
'+' MAIN 2 4
6
'MINUS' MAIN 2 4
_2
2008/4/9, Henry Rich <[EMAIL PROTECTED]>:
>
> PLUS =: 4 : 0
> x+y
> )
> MINUS =: 4 : 0
> x-y
> )
> MAIN =: 3 : 0
>
> NB. WAS: 'a b' =: >0 1 {y but multi assignment unboxes
>
> 'a b' =. 0 1 {y
>
> NB. WAS: VERB =: (>{:y)`:6 but an AR must be boxed
>
> VERB =. ({:y)`:6
> a VERB b
> )
>
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Robert O'Boyle
>
> > Sent: Wednesday, April 09, 2008 4:06 PM
> > To: 'Programming forum'
> > Subject: RE: [Jprogramming] using verbs in the argument list
> > of another veb
> >
> > Thanks, Henry
> >
> > I've tried all sorts of different combos of boxing, unboxing
> > and so on, to
> > no avail. Here is some script to see what I mean
> >
> > PLUS =: 4 : 0
> > x+y
> > )
> > MINUS =: 4 : 0
> > x-y
> > )
> > MAIN =: 3 : 0
> > 'a b' =: >0 1 {y
> > VERB =: (>{:y)`:6
> > a VERB b
> > )
> >
> > Then try MAIN 3;4;PLUS`''. I get a domain error:
> >
> > |domain error: MAIN
> > | VERB=: (>{:y)`:6
> >
> > ???
> >
> > Bob
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Henry Rich
> > Sent: April 9, 2008 4:46 PM
> > To: 'Programming forum'
> > Subject: RE: [Jprogramming] using verbs in the argument list
> > of another veb
> >
> > Your X should be x .
> >
> > Also, the verb named by x must be defined globally.
> >
> > (data; VERB_1`'')
> >
> > may have trouble with the boxing; try
> >
> > (data;< VERB_1`'')
> >
> > Henry Rich
> >
> > > -----Original Message-----
> > > From: [EMAIL PROTECTED]
> > > [mailto:[EMAIL PROTECTED] On Behalf Of
> > Robert O'Boyle
> > > Sent: Wednesday, April 09, 2008 2:34 PM
> > > To: [email protected]
> > > Subject: [Jprogramming] using verbs in the argument list of
> > > another veb
> > >
> > > I am trying to call a verb within the argument list of
> > > another verb. For
> > > instance
> > >
> > >
> > >
> > > MAIN =: 4 : 0
> > >
> > > VERB =. X`: 6
> > >
> > > data =. y
> > >
> > > VERB data
> > >
> > > )
> > >
> > >
> > >
> > > I have a number of VERB s that I would like to insert into the MAIN
> > > function. In other words, different outside verbs use the
> > > same function name
> > > inside the function MAIN. This allows MAIN to be flexible to
> > > use a number of
> > > these outside verbs. I. have tried VERB_1`'' MAIN data but I
> > > get a syntax
> > > error. I tried MAIN being monadic and selecting VERB_1 from a
> > > boxed and
> > > unboxed lists (data; VERB_1`'') all to no avail. When I do
> > > these outside of
> > > a function MAIN, the extraction and execution with the
> > > extracted verb works.
> > > So there is something about putting this functionality in a
> > > function that is
> > > causing issues. Any help would be appreciated.
> > >
> > >
> > >
> > > Bob
> > >
> > >
> > >
> > >
> > >
> > >
> > ----------------------------------------------------------------------
> > > For information about J forums see
> > > http://www.jsoftware.com/forums.htm
> >
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> > ----------------------------------------------------------------------
> > For information about J forums see
> > http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
Björn Helgason, Verkfræðingur
Fugl&Fiskur ehf,
Fornustekkum II, 781 Hornafirði
Po Box 127,801 Selfoss ,
t-póst: [EMAIL PROTECTED]
gsm: +3546985532
Landslags og skrúðgarðagerð, gröfuþjónusta
http://groups.google.com/group/J-Programming
Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans
góður kennari getur stigið á tær án þess að glansinn fari af skónum
/|_ .-----------------------------------.
,' .\ / | Með léttri lund verður |
,--' _,' | Dagurinn í dag |
/ / | Enn betri en gærdagurinn |
( -. | `-----------------------------------'
| ) | (\_ _/)
(`-. '--.) (='.'=)
`. )----' (")_(")
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm