I was lying on the bed just before falling asleep when I came up with
this vector solution, which takes similar approach with yours;
however, much longer than yours:

sti=:[: #.@|: 0=5 3|/]
ali=:([EMAIL PROTECTED]) sti
fb3=:[: > ali { [: ,&('FizzBuzz';'Buzz';'Fizz' ) [: ":&.> 0&,
fb3 >:i.100

2007/3/7, Devon McCormick <[EMAIL PROTECTED]>:
You could use agenda:
  replfb=: ":`('Fizz'&[)`('Buzz'&[)`('FizzBuzz'&[) @. ([: #. 0 = 5 3 | ])
  replfb&>:>i.100
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
16
...

On 3/6/07, Roger Hui <[EMAIL PROTECTED]> wrote:
>
> Well:
>    FB  =: (": [^:([EMAIL PROTECTED]@]) Fizz,Buzz)"0
>    FB1 =: (": (] , [EMAIL PROTECTED] }. [) Fizz,Buzz)"0
>
>    (FB -: FB1) >: i.100
> 1
>    # ;: 5!:5 <'FB'
> 19
>    # ;: 5!:5 <'FB1'
> 17
>
> I could also move the "0 from the definition
> to the expression  FB"0 >:i.100 .  That'd get
> rid of the overall parens.
>
>
>
> ----- Original Message -----
> From: Raul Miller <[EMAIL PROTECTED]>
> Date: Tuesday, March 6, 2007 2:54 pm
> Subject: Re: [Jprogramming] FizzBuzz
>
> > On 3/6/07, Roger Hui <[EMAIL PROTECTED]> wrote:
> > > Fizz=: 'Fizz' #~ 0 = 3&|
> > > Buzz=: 'Buzz' #~ 0 = 5&|
> > > FB  =: (": [^:(0&[EMAIL PROTECTED]@]) Fizz,Buzz)"0
> > > FB >: i.100
> >
> > That's shorter than what I was going to do.
> >
> > That said, FB could be
> >
> > FB=: (": [^:([EMAIL PROTECTED]) Fizz,Buzz)"0
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



--
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
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