Skip to main content
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

J, 9 bytes - 3 = 6

#~@|.*/#~ 

Inspired by @NBZ's APL answer@NBZ's APL answer, golfed down by @randomra. This defines a verb that takes in an array of numbers. It's used as follows:

 (#~@|.*/#~) 4 3 12 12 12 12 9 9 9 12 12 12 12 9 9 9 12 12 12 12 9 9 9 16 16 16 16 12 12 12 16 16 16 16 12 12 12 16 16 16 16 12 12 12 16 16 16 16 12 12 12 

I also claim the 3-byte bonus, since an input of 0 produces sub-matrices of size zero:

 (#~@|.*/#~) 4 0 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 (#~@|.*/#~) 0 3 9 9 9 9 9 9 9 9 9 

Explanation

J has a definite edge in this challenge. In addition to eating array manipulation problems for breakfast, it prints 2D matrices in the correct format by default.

 #~ Replicate each number n in input n times #~@|. The same for reversed input */ Compute their multiplication table 

J, 9 bytes - 3 = 6

#~@|.*/#~ 

Inspired by @NBZ's APL answer, golfed down by @randomra. This defines a verb that takes in an array of numbers. It's used as follows:

 (#~@|.*/#~) 4 3 12 12 12 12 9 9 9 12 12 12 12 9 9 9 12 12 12 12 9 9 9 16 16 16 16 12 12 12 16 16 16 16 12 12 12 16 16 16 16 12 12 12 16 16 16 16 12 12 12 

I also claim the 3-byte bonus, since an input of 0 produces sub-matrices of size zero:

 (#~@|.*/#~) 4 0 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 (#~@|.*/#~) 0 3 9 9 9 9 9 9 9 9 9 

Explanation

J has a definite edge in this challenge. In addition to eating array manipulation problems for breakfast, it prints 2D matrices in the correct format by default.

 #~ Replicate each number n in input n times #~@|. The same for reversed input */ Compute their multiplication table 

J, 9 bytes - 3 = 6

#~@|.*/#~ 

Inspired by @NBZ's APL answer, golfed down by @randomra. This defines a verb that takes in an array of numbers. It's used as follows:

 (#~@|.*/#~) 4 3 12 12 12 12 9 9 9 12 12 12 12 9 9 9 12 12 12 12 9 9 9 16 16 16 16 12 12 12 16 16 16 16 12 12 12 16 16 16 16 12 12 12 16 16 16 16 12 12 12 

I also claim the 3-byte bonus, since an input of 0 produces sub-matrices of size zero:

 (#~@|.*/#~) 4 0 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 (#~@|.*/#~) 0 3 9 9 9 9 9 9 9 9 9 

Explanation

J has a definite edge in this challenge. In addition to eating array manipulation problems for breakfast, it prints 2D matrices in the correct format by default.

 #~ Replicate each number n in input n times #~@|. The same for reversed input */ Compute their multiplication table 
Implement randomra's suggestion
Source Link
Zgarb
  • 43.2k
  • 4
  • 84
  • 265

J, 129 bytes - 3 = 96

(,~*#~@|.*/,)&($~)#~ 

ThisInspired by @NBZ's APL answer, golfed down by @randomra. This defines a dyadic (meaning binary) verb, that takes in an array of numbers. It's used as follows:

  4 (,~*#~@|.*/,)&($~#~) 4 3 12 12 12 12 9 9 9 12 12 12 12 9 9 9 12 12 12 12 9 9 9 16 16 16 16 12 12 12 16 16 16 16 12 12 12 16 16 16 16 12 12 12 16 16 16 16 12 12 12 

I also claim the 3-byte bonus, since an input of 0 produces sub-matrices of size zero:

 4 (,~*#~@|.*/,)&($~#~) 4 0 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16   0 (,~*#~@|.*/,)&($~#~) 0 3 9 9 9 9 9 9 9 9 9 

Explanation

J has a definite edge in this challenge. In addition to eating array manipulation problems for breakfast, it prints 2D matrices in the correct format by default.

  $~#~ Replicate Foreach integernumber n, give arrayin withinput n copies of ntimes  #~@|. &( ) ApplyThe itsame tofor eachreversed input (,~ ,) Concatenate these arrays in both ways */  Compute the multiplication table of the concatenations 

Appendix

There's also a 10-byte version (score of 7 with the bonus), which is basically a translation of this APL answer:

(|.*/])@#~ 

It takes a list of integers and returns a 2D array. Explanation:

  #~ Produce n copies of each list element n ( )@ Pipe to the function in parentheses */ Computetheir multiplication table of |. ] the reversed and unmodified lists 

J, 12 bytes - 3 = 9

(,~*/,)&($~) 

This defines a dyadic (meaning binary) verb, used as follows:

  4 (,~*/,)&($~) 3 12 12 12 12 9 9 9 12 12 12 12 9 9 9 12 12 12 12 9 9 9 16 16 16 16 12 12 12 16 16 16 16 12 12 12 16 16 16 16 12 12 12 16 16 16 16 12 12 12 

I also claim the 3-byte bonus, since an input of 0 produces sub-matrices of size zero:

 4 (,~*/,)&($~) 0 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16   0 (,~*/,)&($~) 3 9 9 9 9 9 9 9 9 9 

Explanation

J has a definite edge in this challenge. In addition to eating array manipulation problems for breakfast, it prints 2D matrices in the correct format by default.

  $~ For integer n, give array with n copies of n   &( ) Apply it to each input (,~ ,) Concatenate these arrays in both ways */  Compute the multiplication table of the concatenations 

Appendix

There's also a 10-byte version (score of 7 with the bonus), which is basically a translation of this APL answer:

(|.*/])@#~ 

It takes a list of integers and returns a 2D array. Explanation:

  #~ Produce n copies of each list element n ( )@ Pipe to the function in parentheses */ Compute multiplication table of |. ] the reversed and unmodified lists 

J, 9 bytes - 3 = 6

#~@|.*/#~ 

Inspired by @NBZ's APL answer, golfed down by @randomra. This defines a verb that takes in an array of numbers. It's used as follows:

 (#~@|.*/#~) 4 3 12 12 12 12 9 9 9 12 12 12 12 9 9 9 12 12 12 12 9 9 9 16 16 16 16 12 12 12 16 16 16 16 12 12 12 16 16 16 16 12 12 12 16 16 16 16 12 12 12 

I also claim the 3-byte bonus, since an input of 0 produces sub-matrices of size zero:

 (#~@|.*/#~) 4 0 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 (#~@|.*/#~) 0 3 9 9 9 9 9 9 9 9 9 

Explanation

J has a definite edge in this challenge. In addition to eating array manipulation problems for breakfast, it prints 2D matrices in the correct format by default.

 #~ Replicate each number n in input n times #~@|. The same for reversed input */ Compute their multiplication table 
added 486 characters in body
Source Link
Zgarb
  • 43.2k
  • 4
  • 84
  • 265

J, 12 bytes - 3 = 9

(,~*/,)&($~) 

This defines a dyadic (meaning binary) verb, used as follows:

 4 (,~*/,)&($~) 3 12 12 12 12 9 9 9 12 12 12 12 9 9 9 12 12 12 12 9 9 9 16 16 16 16 12 12 12 16 16 16 16 12 12 12 16 16 16 16 12 12 12 16 16 16 16 12 12 12 

I also claim the 3-byte bonus, since an input of 0 produces sub-matrices of size zero:

 4 (,~*/,)&($~) 0 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 0 (,~*/,)&($~) 3 9 9 9 9 9 9 9 9 9 

Explanation

J has a definite edge in this challenge. In addition to eating array manipulation problems for breakfast, it prints 2D matrices in the correct format by default.

 $~ For integer n, give array with n copies of n &( ) Apply it to each input (,~ ,) Concatenate these arrays in both ways */ Compute the multiplication table of the concatenations 

Appendix

There's also a 10-byte version (score of 7 with the bonus), which is basically a translation of this APL answer:

(|.*/])@#~ 

It takes a list of integers and returns a 2D array. Explanation:

 #~ Produce n copies of each list element n ( )@ Pipe to the function in parentheses */ Compute multiplication table of |. ] the reversed and unmodified lists 

J, 12 bytes - 3 = 9

(,~*/,)&($~) 

This defines a dyadic (meaning binary) verb, used as follows:

 4 (,~*/,)&($~) 3 12 12 12 12 9 9 9 12 12 12 12 9 9 9 12 12 12 12 9 9 9 16 16 16 16 12 12 12 16 16 16 16 12 12 12 16 16 16 16 12 12 12 16 16 16 16 12 12 12 

I also claim the 3-byte bonus, since an input of 0 produces sub-matrices of size zero:

 4 (,~*/,)&($~) 0 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 0 (,~*/,)&($~) 3 9 9 9 9 9 9 9 9 9 

Explanation

J has a definite edge in this challenge. In addition to eating array manipulation problems for breakfast, it prints 2D matrices in the correct format by default.

 $~ For integer n, give array with n copies of n &( ) Apply it to each input (,~ ,) Concatenate these arrays in both ways */ Compute the multiplication table of the concatenations 

J, 12 bytes - 3 = 9

(,~*/,)&($~) 

This defines a dyadic (meaning binary) verb, used as follows:

 4 (,~*/,)&($~) 3 12 12 12 12 9 9 9 12 12 12 12 9 9 9 12 12 12 12 9 9 9 16 16 16 16 12 12 12 16 16 16 16 12 12 12 16 16 16 16 12 12 12 16 16 16 16 12 12 12 

I also claim the 3-byte bonus, since an input of 0 produces sub-matrices of size zero:

 4 (,~*/,)&($~) 0 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 0 (,~*/,)&($~) 3 9 9 9 9 9 9 9 9 9 

Explanation

J has a definite edge in this challenge. In addition to eating array manipulation problems for breakfast, it prints 2D matrices in the correct format by default.

 $~ For integer n, give array with n copies of n &( ) Apply it to each input (,~ ,) Concatenate these arrays in both ways */ Compute the multiplication table of the concatenations 

Appendix

There's also a 10-byte version (score of 7 with the bonus), which is basically a translation of this APL answer:

(|.*/])@#~ 

It takes a list of integers and returns a 2D array. Explanation:

 #~ Produce n copies of each list element n ( )@ Pipe to the function in parentheses */ Compute multiplication table of |. ] the reversed and unmodified lists 
Added examples and bonus claim.
Source Link
Zgarb
  • 43.2k
  • 4
  • 84
  • 265
Loading
Source Link
Zgarb
  • 43.2k
  • 4
  • 84
  • 265
Loading