News for hackers. Stuff that matters.
Re:FizzBuzz in J, Explained by usr381 on Friday January 20, 2017 @05:37AM (#13442803)
Nice, clever use of base change.

What about something like

    n{:[~#y;$x;y]}'{,/("Fizz";"Buzz")@&~x!/:3 5}'n:1+!20
to avoid duplicating the string combinations? The conditional is unfortunate, would like to get rid of it. But should be straightforward to extend if we want to introduce further string combinations for numbers divisible by, e.g., 7. Though anticipating such things goes against the spirit of k I suppose. :-)

There are no comments on this comment yet.