Skip to main content
fix: UPPER->lower instead of lower->UPPER (thanks to Firefly for catch & correction).
Source Link
Dan Bron
  • 411
  • 4
  • 11

J - 30

'`z''@Z'(]-32*1=I]+32*1=I.)&.(a.&i.)1!:1]1

J is read right-to-left, so to break this down:

  1. Prompt user for input: 1!:1]1
  2. Perform algorithm in code-point-space: &.(a.&i.)
  3. Identify character range for each letter; the characters between codepoints "`""@" and "z""Z" are considered lowercaseuppercase: 1=I..
  4. For each lower-caseuppercase codepoint, subtractadd 32: `']-32* ...']+32* ...
  5. Note that step (2) creates an implicit step (5): we started out by projecting from character to integer domain, so now that we're finished, we map those integers back onto characters.

Obviously this particular implementation only considers ASCII; but the approach could be extended to at least the basic multilingual plane in Unicode.

J - 30

'`z'(]-32*1=I.)&.(a.&i.)1!:1]1

J is read right-to-left, so to break this down:

  1. Prompt user for input: 1!:1]1
  2. Perform algorithm in code-point-space: &.(a.&i.)
  3. Identify character range for each letter; the characters between codepoints "`" and "z" are considered lowercase: 1=I..
  4. For each lower-case codepoint, subtract 32: `']-32* ...'
  5. Note that step (2) creates an implicit step (5): we started out by projecting from character to integer domain, so now that we're finished, we map those integers back onto characters.

Obviously this particular implementation only considers ASCII; but the approach could be extended to at least the basic multilingual plane in Unicode.

J - 30

'@Z'(]+32*1=I.)&.(a.&i.)1!:1]1

J is read right-to-left, so to break this down:

  1. Prompt user for input: 1!:1]1
  2. Perform algorithm in code-point-space: &.(a.&i.)
  3. Identify character range for each letter; the characters between codepoints "@" and "Z" are considered uppercase: 1=I..
  4. For each uppercase codepoint, add 32: ]+32* ...
  5. Note that step (2) creates an implicit step (5): we started out by projecting from character to integer domain, so now that we're finished, we map those integers back onto characters.

Obviously this particular implementation only considers ASCII; but the approach could be extended to at least the basic multilingual plane in Unicode.

Source Link
Dan Bron
  • 411
  • 4
  • 11

J - 30

'`z'(]-32*1=I.)&.(a.&i.)1!:1]1

J is read right-to-left, so to break this down:

  1. Prompt user for input: 1!:1]1
  2. Perform algorithm in code-point-space: &.(a.&i.)
  3. Identify character range for each letter; the characters between codepoints "`" and "z" are considered lowercase: 1=I..
  4. For each lower-case codepoint, subtract 32: `']-32* ...'
  5. Note that step (2) creates an implicit step (5): we started out by projecting from character to integer domain, so now that we're finished, we map those integers back onto characters.

Obviously this particular implementation only considers ASCII; but the approach could be extended to at least the basic multilingual plane in Unicode.