> , { 1 2;3 4 5;0;8 9 
1 3 0 8
1 3 0 9
1 4 0 8
1 4 0 9
1 5 0 8
1 5 0 9
2 3 0 8
2 3 0 9
2 4 0 8
2 4 0 9
2 5 0 8
2 5 0 9

Henry Rich
> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Arie 
> Groeneveld
> Sent: Tuesday, January 29, 2008 7:22 AM
> To: Programming forum
> Subject: Re: [Jprogramming] Re: errata in JfC's cartesian 
> product definition
> 
> cartProd=: [:,@(],&.>"0 1~;@[)/a:,~]
> 
>    >@cartProd 1 2;3 4 5;0;8 9
> 1 3 0 8
> 1 3 0 9
> 1 4 0 8
> 1 4 0 9
> 1 5 0 8
> 1 5 0 9
> 2 3 0 8
> 2 3 0 9
> 2 4 0 8
> 2 4 0 9
> 2 5 0 8
> 2 5 0 9
> 
> =@@i
> 
> 
> June Kim schreef:
> > I recently sent the following email to Henry. I thought it would be
> > nice to know different ways of getting cartesian product(except the
> > built-in catalogue) that other people know.
> >
> > So, do you know of different ways of getting the cartesian 
> product such as,
> >
> >    cpd=:,"_1 _"_ _1
> >    cp=:[: > [: ([: ,/ cpd)&.>/ ,&.>
> >    /:~ cp 1 2;3 4 5;0;8 9
> > 1 3 0 8
> > 1 3 0 9
> > 1 4 0 8
> > 1 4 0 9
> > 1 5 0 8
> > 1 5 0 9
> > 2 3 0 8
> > 2 3 0 9
> > 2 4 0 8
> > 2 4 0 9
> > 2 5 0 8
> > 2 5 0 9
> >
> >
> > 2008/1/29, June Kim <[EMAIL PROTECTED]>:
> >   
> >> Hello,
> >>
> >> on 
> file:///C:/j601/system/extras/help/jforc/odds_and_ends.htm#_To
> c141158196
> >>
> >> There is a definition for cartesian product but I think 
> there is a typo.
> >>
> >> <quote>
> >> The cartesian product can be written in J as ,"_1 " _1 (or, if the
> >> items have rank 0, by the table adverb ,"0/), as seen in 
> this example
> >> where we box each result:
> >>
> >>   'io' <@,"_1 " _1 'nfd'
> >> </quote>
> >>
> >> I think it should've been instead:
> >>
> >> ,"_1 _"_ _1   NB. to be precise and revealing the intention, but...
> >> ,"_1 "_ _1     NB. this would work, too
> >>     
> >
> > Actually, the latter works in the given example, but not in 
> general cases.
> >
> >   
> >> Thank you for your work.
> >>
> >> June Kim
> >>
> >>     
> > 
> ----------------------------------------------------------------------
> > 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

Reply via email to