Skip to main content
added 78 characters in body
Source Link
Sanchises
  • 9.5k
  • 1
  • 36
  • 61

Octave, 50 bytes

@(t)'				'/3*sum(65:90==t')'

Try it online!

Challenge accepted. Explanation:

@(t)             % Define anonymous function taking a single argument t.
    ' ... '/3       % Row vector with letter scores. Corresponds to char([1 3 3 2 ...]*3). 
                 % The factor 3 was necessary to avoid a newline.

*                % Dot product (yes, * is dot product, .* is not. Go figure). Equivalent to sum of element-wise products.
     65:90       % Alphabet
          ==t'   % Broadcast equality with input string.
 sum(         )  % Sum this matrix. Gives the count of each letter in the alphabet
               ' % Transpose into column vector for dot product

Octave, 50 bytes

@(t)'				'/3*sum(65:90==t')'

Try it online!

Challenge accepted. Explanation:

 ' ... '/3       % Row vector with letter scores. Corresponds to char([1 3 3 2 ...]*3). 
                 % The factor 3 was necessary to avoid a newline.

*                % Dot product (yes, * is dot product, .* is not. Go figure). Equivalent to sum of element-wise products.
     65:90       % Alphabet
          ==t'   % Broadcast equality with input string.
 sum(         )  % Sum this matrix. Gives the count of each letter in the alphabet
               ' % Transpose into column vector for dot product

Octave, 50 bytes

@(t)'				'/3*sum(65:90==t')'

Try it online!

Challenge accepted. Explanation:

@(t)             % Define anonymous function taking a single argument t.
    ' ... '/3    % Row vector with letter scores. Corresponds to char([1 3 3 2 ...]*3). 
                 % The factor 3 was necessary to avoid a newline.

*                % Dot product (yes, * is dot product, .* is not. Go figure). Equivalent to sum of element-wise products.
     65:90       % Alphabet
          ==t'   % Broadcast equality with input string.
 sum(         )  % Sum this matrix. Gives the count of each letter in the alphabet
               ' % Transpose into column vector for dot product
added 46 characters in body
Source Link
Sanchises
  • 9.5k
  • 1
  • 36
  • 61

Octave, 50 bytes

@(t)'				'/3*sum(65:90==t')'

Try it online!

Challenge accepted. Explanation:

 (' ... '/3)'       % ColumnRow vector with letter scores. Corresponds to char([1 3 3 2 ...]*3). 
                 % The factor 3 was necessary to avoid a newline.

*                % Dot product (yes, * is dot product, .* is not. Go figure). Equivalent to sum of element-wise products.
     65:90       % Alphabet
          ==t'   % Broadcast equality with input string.
 sum(         )  % Sum this matrix. Gives the count of each letter in the alphabet
               ' % Transpose into column vector for dot product

Octave, 50 bytes

@(t)'				'/3*sum(65:90==t')'

Try it online!

Challenge accepted. Explanation:

 (' ... '/3)'    % Column vector with letter scores. Corresponds to char([1 3 3 2 ...]*3). 
                 % The factor 3 was necessary to avoid a newline.

*                % Dot product (yes, * is dot product, .* is not. Go figure). Equivalent to sum of element-wise products.
     65:90       % Alphabet
          ==t'   % Broadcast equality with input string.
 sum(         )  % Sum this matrix. Gives the count of each letter in the alphabet
              

Octave, 50 bytes

@(t)'				'/3*sum(65:90==t')'

Try it online!

Challenge accepted. Explanation:

 ' ... '/3       % Row vector with letter scores. Corresponds to char([1 3 3 2 ...]*3). 
                 % The factor 3 was necessary to avoid a newline.

*                % Dot product (yes, * is dot product, .* is not. Go figure). Equivalent to sum of element-wise products.
     65:90       % Alphabet
          ==t'   % Broadcast equality with input string.
 sum(         )  % Sum this matrix. Gives the count of each letter in the alphabet
               ' % Transpose into column vector for dot product
added 533 characters in body
Source Link
Sanchises
  • 9.5k
  • 1
  • 36
  • 61

Octave, 5250 bytes

@(t)sum'				'/3*sum(65:90==t')*('				'/3)'

Try it online!Try it online!

Challenge accepted. Explanation:

 (' ... '/3)'    % Column vector with letter scores. Corresponds to char([1 3 3 2 ...]*3). 
                 % The factor 3 was necessary to avoid a newline.

*                % Dot product (yes, * is dot product, .* is not. Go figure). Equivalent to sum of element-wise products.
     65:90       % Alphabet
          ==t'   % Broadcast equality with input string.
 sum(         )  % Sum this matrix. Gives the count of each letter in the alphabet
              

Octave, 52 bytes

@(t)sum(65:90==t')*('				'/3)'

Try it online!

Challenge accepted.

Octave, 50 bytes

@(t)'				'/3*sum(65:90==t')'

Try it online!

Challenge accepted. Explanation:

 (' ... '/3)'    % Column vector with letter scores. Corresponds to char([1 3 3 2 ...]*3). 
                 % The factor 3 was necessary to avoid a newline.

*                % Dot product (yes, * is dot product, .* is not. Go figure). Equivalent to sum of element-wise products.
     65:90       % Alphabet
          ==t'   % Broadcast equality with input string.
 sum(         )  % Sum this matrix. Gives the count of each letter in the alphabet
              
Source Link
Sanchises
  • 9.5k
  • 1
  • 36
  • 61
Loading