Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Commonmark migration
Source Link

###Explanation

Explanation

###Explanation

Explanation

added 208 characters in body
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382
c % Input cell array of strings implicitly. Convert to 2D char array,
 % right-padding with spaces
 % STACK: ['aaaa'; 'bb '; 'ccc']
! % Transpose
 % STACK: ['abc'
 'abc'
 'a c'
 'a ']
t % Duplicate
 % STACK: ['abc'
 'abc'
 'a c'
 'a '],
 ['abc'
 'abc'
 'a c'
 'a '],
&n % Number of rows and of columns
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], 4, 3
:q % Range, subtract 1
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], 4, [0 1 2]
3_* % Multiply by -3
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], 4, [0 -3 -6]
ts_ % Duplicate, sum, negate
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], 4, [0 -3 -6], 9
b % Bubble up in stack
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], [0 -3 -6], 9, 4
+ % Add
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], [0 -3 -6], 13
5M % Push second input of last function again
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], [0 -3 -6], 13, 4
4$Xd % Buld numerical sparse matrix from the above four arguments. The
 % columns of the first input argument will be the diagonals of the
 % result, with indices given bu the second input (negative is below
 % main diagonal). The matrix size is the third and fourth arguments
 % STACK: [97 0 0 0
 0 97 0 0
 0 0 97 0
 98 0 0 97
 0 98 0 0
 0 0 32 0
 99 0 0 32
 0 99 0 0
 0 0 99 0
 0 0 0 32
 0 0 0 0
 0 0 0 0
 0 0 0 0]
Z!c % Convert from sparse to full, and then to char. Character 0 is
 % displayed as space
 % STACK: ['a '
 ' a '
 ' a '
 'b a'
 ' b '
 ' '
 'c '
 ' c '
 ' c '
 ' '
 ' '
 ' '
 ' ']
Z{ % Split into cell array, with each row in a cell
 % STACK: {'a ', ' a ', ' a ', 'b a', ' b ', ' ', 'c ', ' c ', ' c ', ' ', ' ', ' ', ' '}
Zv % DeblanckDeblank: remove trailing space from each string. Implicitly display,
 % each string on a different line. Empty strings do not generate
 % a newline
 % STACK: {'a ', ' a', ' a', 'b a', ' b', '', 'c', ' c', ' c', '', '', '', ''}
c % Input cell array of strings implicitly. Convert to 2D char array,
 % right-padding with spaces
 % STACK: ['aaaa'; 'bb '; 'ccc']
! % Transpose
 % STACK: ['abc'
 'abc'
 'a c'
 'a ']
t % Duplicate
 % STACK: ['abc'
 'abc'
 'a c'
 'a '],
 ['abc'
 'abc'
 'a c'
 'a '],
&n % Number of rows and of columns
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], 4, 3
:q % Range, subtract 1
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], 4, [0 1 2]
3_* % Multiply by -3
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], 4, [0 -3 -6]
ts_ % Duplicate, sum, negate
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], 4, [0 -3 -6], 9
b % Bubble up in stack
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], [0 -3 -6], 9, 4
+ % Add
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], [0 -3 -6], 13
5M % Push second input of last function again
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], [0 -3 -6], 13, 4
4$Xd % Buld numerical sparse matrix from the above four arguments. The
 % columns of the first input argument will be the diagonals of the
 % result, with indices given bu the second input (negative is below
 % main diagonal). The matrix size is the third and fourth arguments
 % STACK: [97 0 0 0
 0 97 0 0
 0 0 97 0
 98 0 0 97
 0 98 0 0
 0 0 32 0
 99 0 0 32
 0 99 0 0
 0 0 99 0
 0 0 0 32
 0 0 0 0
 0 0 0 0
 0 0 0 0]
Z!c % Convert from sparse to full, and then to char. Character 0 is
 % displayed as space
 % STACK: ['a '
 ' a '
 ' a '
 'b a'
 ' b '
 ' '
 'c '
 ' c '
 ' c ']
Z{ % Split into cell array, with each row in a cell
 % STACK: {'a ', ' a ', ' a ', 'b a', ' b ', ' ', 'c ', ' c ', ' c '}
Zv % Deblanck: remove trailing space from each string. Implicitly display,
 % each string on a different line
 % STACK: {'a ', ' a', ' a', 'b a', ' b', '', 'c', ' c', ' c'}
c % Input cell array of strings implicitly. Convert to 2D char array,
 % right-padding with spaces
 % STACK: ['aaaa'; 'bb '; 'ccc']
! % Transpose
 % STACK: ['abc'
 'abc'
 'a c'
 'a ']
t % Duplicate
 % STACK: ['abc'
 'abc'
 'a c'
 'a '],
 ['abc'
 'abc'
 'a c'
 'a '],
&n % Number of rows and of columns
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], 4, 3
:q % Range, subtract 1
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], 4, [0 1 2]
3_* % Multiply by -3
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], 4, [0 -3 -6]
ts_ % Duplicate, sum, negate
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], 4, [0 -3 -6], 9
b % Bubble up in stack
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], [0 -3 -6], 9, 4
+ % Add
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], [0 -3 -6], 13
5M % Push second input of last function again
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], [0 -3 -6], 13, 4
4$Xd % Buld numerical sparse matrix from the above four arguments. The
 % columns of the first input argument will be the diagonals of the
 % result, with indices given bu the second input (negative is below
 % main diagonal). The matrix size is the third and fourth arguments
 % STACK: [97 0 0 0
 0 97 0 0
 0 0 97 0
 98 0 0 97
 0 98 0 0
 0 0 32 0
 99 0 0 32
 0 99 0 0
 0 0 99 0
 0 0 0 32
 0 0 0 0
 0 0 0 0
 0 0 0 0]
Z!c % Convert from sparse to full, and then to char. Character 0 is
 % displayed as space
 % STACK: ['a '
 ' a '
 ' a '
 'b a'
 ' b '
 ' '
 'c '
 ' c '
 ' c '
 ' '
 ' '
 ' '
 ' ']
Z{ % Split into cell array, with each row in a cell
 % STACK: {'a ', ' a ', ' a ', 'b a', ' b ', ' ', 'c ', ' c ', ' c ', ' ', ' ', ' ', ' '}
Zv % Deblank: remove trailing space from each string. Implicitly display,
 % each string on a different line. Empty strings do not generate
 % a newline
 % STACK: {'a ', ' a', ' a', 'b a', ' b', '', 'c', ' c', ' c', '', '', '', ''}
deleted 10 characters in body
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382
c % Input cell array of strings implicitly. Convert to 2D char array,
 % right-padding with spaces
 % STACK: ['aaaa'; 'bb '; 'ccc']
! % Transpose
 % STACK: ['abc'
 'abc';'abc'
 'a c'
 'a ']
t % Duplicate
 % STACK: ['abc'
 'abc';'abc'
 'a c'
 'a '],
 ['abc'
 'abc';'abc'
 'a c'
 'a '],
&n % Number of rows and of columns
 % STACK: ['abc'
 'abc';'abc'
 'a c'
 'a '], 4, 3
:q % Range, subtract 1
 % STACK: ['abc'
 'abc';'abc'
 'a c'
 'a '], 4, [0 1 2]
3_* % Multiply by -3
 % STACK: ['abc'
 'abc';'abc'
 'a c'
 'a '], 4, [0 -3 -6]
ts_ % Duplicate, sum, negate
 % STACK: ['abc'
 'abc';'abc'
 'a c'
 'a '], 4, [0 -3 -6], 9
b % Bubble up in stack
 % STACK: ['abc'
 'abc';'abc'
 'a c'
 'a '], [0 -3 -6], 9, 4
+ % Add
 % STACK: ['abc'
 'abc';'abc'
 'a c'
 'a '], [0 -3 -6], 13
5M % Push second input of last function again
 % STACK: ['abc'
 'abc';'abc'
 'a c'
 'a '], [0 -3 -6], 13, 4
4$Xd % Buld numerical sparse matrix from the above four arguments. The
 % columns of the first input argument will be the diagonals of the
 % result, with indices given bu the second input (negative is below
 % main diagonal). The matrix size is the third and fourth arguments
 % STACK: [97 0 0 0
 0 97 0 0
 0 0 97 0
 98 0 0 97
 0 98 0 0
 0 0 32 0
 99 0 0 32
 0 99 0 0
 0 0 99 0
 0 0 0 32
 0 0 0 0
 0 0 0 0
 0 0 0 0]
Z!c % Convert from sparse to full, and then to char. Character 0 is
 % displayed as space
 % STACK: ['a '
 ' a '
 ' a '
 'b a'
 ' b '
 ' '
 'c '
 ' c '
 ' c ']
Z{ % Split into cell array, with each row in a cell
 % STACK: {'a ', ' a ', ' a ', 'b a', ' b ', ' ', 'c ', ' c ', ' c '}
Zv % Deblanck: remove trailing space from each string. Implicitly display,
 % each string on a different line
 % STACK: {'a ', ' a', ' a', 'b a', ' b', '', 'c', ' c', ' c'}
c % Input cell array of strings implicitly. Convert to 2D char array,
 % right-padding with spaces
 % STACK: ['aaaa'; 'bb '; 'ccc']
! % Transpose
 % STACK: ['abc'
 'abc';
 'a c'
 'a ']
t % Duplicate
 % STACK: ['abc'
 'abc';
 'a c'
 'a '],
 ['abc'
 'abc';
 'a c'
 'a '],
&n % Number of rows and of columns
 % STACK: ['abc'
 'abc';
 'a c'
 'a '], 4, 3
:q % Range, subtract 1
 % STACK: ['abc'
 'abc';
 'a c'
 'a '], 4, [0 1 2]
3_* % Multiply by -3
 % STACK: ['abc'
 'abc';
 'a c'
 'a '], 4, [0 -3 -6]
ts_ % Duplicate, sum, negate
 % STACK: ['abc'
 'abc';
 'a c'
 'a '], 4, [0 -3 -6], 9
b % Bubble up in stack
 % STACK: ['abc'
 'abc';
 'a c'
 'a '], [0 -3 -6], 9, 4
+ % Add
 % STACK: ['abc'
 'abc';
 'a c'
 'a '], [0 -3 -6], 13
5M % Push second input of last function again
 % STACK: ['abc'
 'abc';
 'a c'
 'a '], [0 -3 -6], 13, 4
4$Xd % Buld numerical sparse matrix from the above four arguments. The
 % columns of the first input argument will be the diagonals of the
 % result, with indices given bu the second input (negative is below
 % main diagonal). The matrix size is the third and fourth arguments
 % STACK: [97 0 0 0
 0 97 0 0
 0 0 97 0
 98 0 0 97
 0 98 0 0
 0 0 32 0
 99 0 0 32
 0 99 0 0
 0 0 99 0
 0 0 0 32
 0 0 0 0
 0 0 0 0
 0 0 0 0]
Z!c % Convert from sparse to full, and then to char. Character 0 is
 % displayed as space
 % STACK: ['a '
 ' a '
 ' a '
 'b a'
 ' b '
 ' '
 'c '
 ' c '
 ' c ']
Z{ % Split into cell array, with each row in a cell
 % STACK: {'a ', ' a ', ' a ', 'b a', ' b ', ' ', 'c ', ' c ', ' c '}
Zv % Deblanck: remove trailing space from each string. Implicitly display,
 % each string on a different line
 % STACK: {'a ', ' a', ' a', 'b a', ' b', '', 'c', ' c', ' c'}
c % Input cell array of strings implicitly. Convert to 2D char array,
 % right-padding with spaces
 % STACK: ['aaaa'; 'bb '; 'ccc']
! % Transpose
 % STACK: ['abc'
 'abc'
 'a c'
 'a ']
t % Duplicate
 % STACK: ['abc'
 'abc'
 'a c'
 'a '],
 ['abc'
 'abc'
 'a c'
 'a '],
&n % Number of rows and of columns
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], 4, 3
:q % Range, subtract 1
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], 4, [0 1 2]
3_* % Multiply by -3
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], 4, [0 -3 -6]
ts_ % Duplicate, sum, negate
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], 4, [0 -3 -6], 9
b % Bubble up in stack
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], [0 -3 -6], 9, 4
+ % Add
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], [0 -3 -6], 13
5M % Push second input of last function again
 % STACK: ['abc'
 'abc'
 'a c'
 'a '], [0 -3 -6], 13, 4
4$Xd % Buld numerical sparse matrix from the above four arguments. The
 % columns of the first input argument will be the diagonals of the
 % result, with indices given bu the second input (negative is below
 % main diagonal). The matrix size is the third and fourth arguments
 % STACK: [97 0 0 0
 0 97 0 0
 0 0 97 0
 98 0 0 97
 0 98 0 0
 0 0 32 0
 99 0 0 32
 0 99 0 0
 0 0 99 0
 0 0 0 32
 0 0 0 0
 0 0 0 0
 0 0 0 0]
Z!c % Convert from sparse to full, and then to char. Character 0 is
 % displayed as space
 % STACK: ['a '
 ' a '
 ' a '
 'b a'
 ' b '
 ' '
 'c '
 ' c '
 ' c ']
Z{ % Split into cell array, with each row in a cell
 % STACK: {'a ', ' a ', ' a ', 'b a', ' b ', ' ', 'c ', ' c ', ' c '}
Zv % Deblanck: remove trailing space from each string. Implicitly display,
 % each string on a different line
 % STACK: {'a ', ' a', ' a', 'b a', ' b', '', 'c', ' c', ' c'}
added 6 characters in body
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382
Loading
added 3466 characters in body
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382
Loading
deleted 10 characters in body
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382
Loading
added 4 characters in body
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382
Loading
added 508 characters in body
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382
Loading
Source Link
Luis Mendo
  • 106.7k
  • 10
  • 139
  • 382
Loading

AltStyle によって変換されたページ (->オリジナル) /