Re:FizzBuzz in J, Explained
by klibertp on Thursday January 19, 2017 @05:52PM
(#13440221)
There's a blog post about FizzBuzzBazz (note the third value) in LiveScript, I posted a comment there, with J version[1], looking like this:
fu=:(3&|),(5&|),:(7&|)
g1=:(,&'zz')"1>;:'Fi Bu Ba'
((0=fu i.101){"1(3 1$<''),.(,.<"1 g1)),<"0 i.101
Well, what else can I say? J is really fun to play with.
It's also not true that it cannot be maintainable or readable. J crazy parsing rules and other language features make it very flexible, on the level of Lisp, TCL, PERL, Smalltalk or Io. This means it can be a completely unreadable mess, as well as a readable and maintainable code, depending on who writes it. I made an attempt at writing readable - articulate - J: https://klibert.pl/posts/literate_j.html
Re:FizzBuzz in J, Explained
by kazinator on Thursday January 19, 2017 @09:26PM
(#13441329)
That cryptic code, ironically, doesn't appear significantly shorter, if at all, than the FizzBuzz solutions in some ordinary, readable languages. What's the point?
It's also not true that it cannot be maintainable or readable. J crazy parsing rules and other language features make it very flexible, on the level of Lisp, TCL, PERL, Smalltalk or Io. This means it can be a completely unreadable mess, as well as a readable and maintainable code, depending on who writes it. I made an attempt at writing readable - articulate - J: https://klibert.pl/posts/literate_j.html
[1] http://livescript.net/blog/fizzbuzzbazz.html#comment-1145818...