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

#Dyalog APL , (削除) 10 (削除ここまで) 11 bytes

Dyalog APL , (削除) 10 (削除ここまで) 11 bytes

(↑⍳∘⍴⌽ ̈⊂)⎕A

TryAPL online!

Requires ⎕IO←0 which is standard on many systems.

The generalized 7-char function is just ↑⍳∘⍴⌽ ̈⊂:

make the following list of strings into a character table:
the indices
of
the length of the argument, i.e [1, 2, 3, ..., 26]
⌽ ̈ each rotate
the entire argument

With the argument of ⎕A (uppercase alphabet) we get the desired result, but any argument can be fed to get the corresponding cipher:

 f←↑⍳∘⍴⌽ ̈⊂
 ×ばつo+

In fact, even strings and numbers are allowed:

 f'Alpha' 'Bravo' 'Charlie' 'Delta'
┌───────┬───────┬───────┬───────┐
│Alpha │Bravo │Charlie│Delta │
├───────┼───────┼───────┼───────┤
│Bravo │Charlie│Delta │Alpha │
├───────┼───────┼───────┼───────┤
│Charlie│Delta │Alpha │Bravo │
├───────┼───────┼───────┼───────┤
│Delta │Alpha │Bravo │Charlie│
└───────┴───────┴───────┴───────┘
 f⍳8
0 1 2 3 4 5 6 7
1 2 3 4 5 6 7 0
2 3 4 5 6 7 0 1
3 4 5 6 7 0 1 2
4 5 6 7 0 1 2 3
5 6 7 0 1 2 3 4
6 7 0 1 2 3 4 5
7 0 1 2 3 4 5 6

#Dyalog APL , (削除) 10 (削除ここまで) 11 bytes

(↑⍳∘⍴⌽ ̈⊂)⎕A

TryAPL online!

Requires ⎕IO←0 which is standard on many systems.

The generalized 7-char function is just ↑⍳∘⍴⌽ ̈⊂:

make the following list of strings into a character table:
the indices
of
the length of the argument, i.e [1, 2, 3, ..., 26]
⌽ ̈ each rotate
the entire argument

With the argument of ⎕A (uppercase alphabet) we get the desired result, but any argument can be fed to get the corresponding cipher:

 f←↑⍳∘⍴⌽ ̈⊂
 ×ばつo+

In fact, even strings and numbers are allowed:

 f'Alpha' 'Bravo' 'Charlie' 'Delta'
┌───────┬───────┬───────┬───────┐
│Alpha │Bravo │Charlie│Delta │
├───────┼───────┼───────┼───────┤
│Bravo │Charlie│Delta │Alpha │
├───────┼───────┼───────┼───────┤
│Charlie│Delta │Alpha │Bravo │
├───────┼───────┼───────┼───────┤
│Delta │Alpha │Bravo │Charlie│
└───────┴───────┴───────┴───────┘
 f⍳8
0 1 2 3 4 5 6 7
1 2 3 4 5 6 7 0
2 3 4 5 6 7 0 1
3 4 5 6 7 0 1 2
4 5 6 7 0 1 2 3
5 6 7 0 1 2 3 4
6 7 0 1 2 3 4 5
7 0 1 2 3 4 5 6

Dyalog APL , (削除) 10 (削除ここまで) 11 bytes

(↑⍳∘⍴⌽ ̈⊂)⎕A

TryAPL online!

Requires ⎕IO←0 which is standard on many systems.

The generalized 7-char function is just ↑⍳∘⍴⌽ ̈⊂:

make the following list of strings into a character table:
the indices
of
the length of the argument, i.e [1, 2, 3, ..., 26]
⌽ ̈ each rotate
the entire argument

With the argument of ⎕A (uppercase alphabet) we get the desired result, but any argument can be fed to get the corresponding cipher:

 f←↑⍳∘⍴⌽ ̈⊂
 ×ばつo+

In fact, even strings and numbers are allowed:

 f'Alpha' 'Bravo' 'Charlie' 'Delta'
┌───────┬───────┬───────┬───────┐
│Alpha │Bravo │Charlie│Delta │
├───────┼───────┼───────┼───────┤
│Bravo │Charlie│Delta │Alpha │
├───────┼───────┼───────┼───────┤
│Charlie│Delta │Alpha │Bravo │
├───────┼───────┼───────┼───────┤
│Delta │Alpha │Bravo │Charlie│
└───────┴───────┴───────┴───────┘
 f⍳8
0 1 2 3 4 5 6 7
1 2 3 4 5 6 7 0
2 3 4 5 6 7 0 1
3 4 5 6 7 0 1 2
4 5 6 7 0 1 2 3
5 6 7 0 1 2 3 4
6 7 0 1 2 3 4 5
7 0 1 2 3 4 5 6
reformatted explanation
Source Link
Adám
  • 31.8k
  • 4
  • 131
  • 292

#Dyalog APL, (削除) 10 (削除ここまで) 11 bytes

(↑⍳∘⍴⌽ ̈⊂)⎕A

TryAPL online!

Requires ⎕IO←0 which is standard on many systems.

The generalized 7-char function is just ↑⍳∘⍴⌽ ̈⊂:

make the following list of strings into a character table:
the indices
of
the length of the argument, i.e [1, 2, 3, ..., 26]
⌽ ̈ each rotate
the entire argument

TheWith the argument of ⎕A (uppercase alphabet) we get the desired result, but any argument can be fed to get the corresponding cipher:

 f←↑⍳∘⍴⌽ ̈⊂
 ×ばつo+

In fact, even strings and numbers are allowed:

 f'Alpha' 'Bravo' 'Charlie' 'Delta'
┌───────┬───────┬───────┬───────┐
│Alpha │Bravo │Charlie│Delta │
├───────┼───────┼───────┼───────┤
│Bravo │Charlie│Delta │Alpha │
├───────┼───────┼───────┼───────┤
│Charlie│Delta │Alpha │Bravo │
├───────┼───────┼───────┼───────┤
│Delta │Alpha │Bravo │Charlie│
└───────┴───────┴───────┴───────┘
 f⍳8
0 1 2 3 4 5 6 7
1 2 3 4 5 6 7 0
2 3 4 5 6 7 0 1
3 4 5 6 7 0 1 2
4 5 6 7 0 1 2 3
5 6 7 0 1 2 3 4
6 7 0 1 2 3 4 5
7 0 1 2 3 4 5 6

#Dyalog APL, (削除) 10 (削除ここまで) 11 bytes

(↑⍳∘⍴⌽ ̈⊂)⎕A

TryAPL online!

Requires ⎕IO←0 which is standard on many systems.

The generalized 7-char function is just ↑⍳∘⍴⌽ ̈⊂:

make the following list of strings into a character table:
the indices
of
the length of the argument, i.e [1, 2, 3, ..., 26]
⌽ ̈ each rotate
the entire argument

The the argument of ⎕A (uppercase alphabet) we get the desired result, but any argument can be fed to get the corresponding cipher:

 f←↑⍳∘⍴⌽ ̈⊂
 ×ばつo+

In fact, even strings and numbers are allowed:

 f'Alpha' 'Bravo' 'Charlie' 'Delta'
┌───────┬───────┬───────┬───────┐
│Alpha │Bravo │Charlie│Delta │
├───────┼───────┼───────┼───────┤
│Bravo │Charlie│Delta │Alpha │
├───────┼───────┼───────┼───────┤
│Charlie│Delta │Alpha │Bravo │
├───────┼───────┼───────┼───────┤
│Delta │Alpha │Bravo │Charlie│
└───────┴───────┴───────┴───────┘
 f⍳8
0 1 2 3 4 5 6 7
1 2 3 4 5 6 7 0
2 3 4 5 6 7 0 1
3 4 5 6 7 0 1 2
4 5 6 7 0 1 2 3
5 6 7 0 1 2 3 4
6 7 0 1 2 3 4 5
7 0 1 2 3 4 5 6

#Dyalog APL, (削除) 10 (削除ここまで) 11 bytes

(↑⍳∘⍴⌽ ̈⊂)⎕A

TryAPL online!

Requires ⎕IO←0 which is standard on many systems.

The generalized 7-char function is just ↑⍳∘⍴⌽ ̈⊂:

make the following list of strings into a character table:
the indices
of
the length of the argument, i.e [1, 2, 3, ..., 26]
⌽ ̈ each rotate
the entire argument

With the argument of ⎕A (uppercase alphabet) we get the desired result, but any argument can be fed to get the corresponding cipher:

 f←↑⍳∘⍴⌽ ̈⊂
 ×ばつo+

In fact, even strings and numbers are allowed:

 f'Alpha' 'Bravo' 'Charlie' 'Delta'
┌───────┬───────┬───────┬───────┐
│Alpha │Bravo │Charlie│Delta │
├───────┼───────┼───────┼───────┤
│Bravo │Charlie│Delta │Alpha │
├───────┼───────┼───────┼───────┤
│Charlie│Delta │Alpha │Bravo │
├───────┼───────┼───────┼───────┤
│Delta │Alpha │Bravo │Charlie│
└───────┴───────┴───────┴───────┘
 f⍳8
0 1 2 3 4 5 6 7
1 2 3 4 5 6 7 0
2 3 4 5 6 7 0 1
3 4 5 6 7 0 1 2
4 5 6 7 0 1 2 3
5 6 7 0 1 2 3 4
6 7 0 1 2 3 4 5
7 0 1 2 3 4 5 6
print as shown
Source Link
Adám
  • 31.8k
  • 4
  • 131
  • 292

#Dyalog APL, 10 (削除) 10 (削除ここまで) 11 bytes

(⍳∘⍴⌽ ̈⊂↑⍳∘⍴⌽ ̈⊂)⎕A

TryAPL online! TryAPL online!

Requires ⎕IO←0 which is standard on many systems.

The generalized 67-char function is just ⍳∘⍴⌽ ̈⊂↑⍳∘⍴⌽ ̈⊂:

make the following list of strings into a character table:
the indices
of
the length of the argument, i.e [1, 2, 3, ..., 26]
⌽ ̈ each rotate
the entire argument

The the argument of ⎕A (uppercase alphabet) we get the desired result, but any argument can be fed to get the corresponding cipher:

 f←⍳∘⍴⌽ ̈⊂f←↑⍳∘⍴⌽ ̈⊂
 ×ばつ'
┌───┬───┬───┐×ばつ
×ばつo+│×ばつo
└───┴───┴───┘×ばつo+

In fact, even strings and numbers are allowed:

 f'Alpha' 'Bravo' 'Charlie' 'Delta'
┌───────────────────────────┬───────────────────────────┬───────────────────────────┬───────────────────────────┐┌───────┬───────┬───────┬───────┐
│┌─────┬─────┬───────┬─────┐│┌─────┬───────┬─────┬─────┐│┌───────┬─────┬─────┬─────┐│┌─────┬─────┬─────┬───────┐││Alpha │Bravo │Charlie│Delta │
││Alpha│Bravo│Charlie│Delta│││Bravo│Charlie│Delta│Alpha│││Charlie│Delta│Alpha│Bravo│││Delta│Alpha│Bravo│Charlie││├───────┼───────┼───────┼───────┤
│└─────┴─────┴───────┴─────┘│└─────┴───────┴─────┴─────┘│└───────┴─────┴─────┴─────┘│└─────┴─────┴─────┴───────┘││Bravo │Charlie│Delta │Alpha │
└───────────────────────────┴───────────────────────────┴───────────────────────────┴───────────────────────────┘├───────┼───────┼───────┼───────┤
│Charlie│Delta │Alpha │Bravo f⍳8
┌───────────────┬───────────────┬───────────────┬───────────────┬───────────────┬───────────────┬───────────────┬───────────────┐├───────┼───────┼───────┼───────┤
│0│Delta │Alpha │Bravo │Charlie│
└───────┴───────┴───────┴───────┘
 f⍳8
0 1 2 3 4 5 6 7│17
1 2 3 4 5 6 7 0│20
2 3 4 5 6 7 0 1│31
3 4 5 6 7 0 1 2│42
4 5 6 7 0 1 2 3│53
5 6 7 0 1 2 3 4│64
6 7 0 1 2 3 4 5│75
7 0 1 2 3 4 5 6│
└───────────────┴───────────────┴───────────────┴───────────────┴───────────────┴───────────────┴───────────────┴───────────────┘6

#Dyalog APL, 10 bytes

(⍳∘⍴⌽ ̈⊂)⎕A

TryAPL online!

Requires ⎕IO←0 which is standard on many systems.

The generalized 6-char function is just ⍳∘⍴⌽ ̈⊂:

the indices
of
the length of the argument, i.e [1, 2, 3, ..., 26]
⌽ ̈ each rotate
the entire argument

The the argument of ⎕A (uppercase alphabet) we get the desired result, but any argument can be fed to get the corresponding cipher:

 f←⍳∘⍴⌽ ̈⊂
 ×ばつ'
┌───┬───┬───┐
×ばつo+│
└───┴───┴───┘

In fact, even strings and numbers are allowed:

 f'Alpha' 'Bravo' 'Charlie' 'Delta'
┌───────────────────────────┬───────────────────────────┬───────────────────────────┬───────────────────────────┐
│┌─────┬─────┬───────┬─────┐│┌─────┬───────┬─────┬─────┐│┌───────┬─────┬─────┬─────┐│┌─────┬─────┬─────┬───────┐│
││Alpha│Bravo│Charlie│Delta│││Bravo│Charlie│Delta│Alpha│││Charlie│Delta│Alpha│Bravo│││Delta│Alpha│Bravo│Charlie││
│└─────┴─────┴───────┴─────┘│└─────┴───────┴─────┴─────┘│└───────┴─────┴─────┴─────┘│└─────┴─────┴─────┴───────┘│
└───────────────────────────┴───────────────────────────┴───────────────────────────┴───────────────────────────┘
 f⍳8
┌───────────────┬───────────────┬───────────────┬───────────────┬───────────────┬───────────────┬───────────────┬───────────────┐
│0 1 2 3 4 5 6 7│1 2 3 4 5 6 7 0│2 3 4 5 6 7 0 1│3 4 5 6 7 0 1 2│4 5 6 7 0 1 2 3│5 6 7 0 1 2 3 4│6 7 0 1 2 3 4 5│7 0 1 2 3 4 5 6│
└───────────────┴───────────────┴───────────────┴───────────────┴───────────────┴───────────────┴───────────────┴───────────────┘

#Dyalog APL, (削除) 10 (削除ここまで) 11 bytes

(↑⍳∘⍴⌽ ̈⊂)⎕A

TryAPL online!

Requires ⎕IO←0 which is standard on many systems.

The generalized 7-char function is just ↑⍳∘⍴⌽ ̈⊂:

make the following list of strings into a character table:
the indices
of
the length of the argument, i.e [1, 2, 3, ..., 26]
⌽ ̈ each rotate
the entire argument

The the argument of ⎕A (uppercase alphabet) we get the desired result, but any argument can be fed to get the corresponding cipher:

 f←↑⍳∘⍴⌽ ̈⊂
 ×ばつ'
×ばつ
×ばつo
×ばつo+

In fact, even strings and numbers are allowed:

 f'Alpha' 'Bravo' 'Charlie' 'Delta'
┌───────┬───────┬───────┬───────┐
│Alpha │Bravo │Charlie│Delta │
├───────┼───────┼───────┼───────┤
│Bravo │Charlie│Delta │Alpha │
├───────┼───────┼───────┼───────┤
│Charlie│Delta │Alpha │Bravo 
├───────┼───────┼───────┼───────┤
│Delta │Alpha │Bravo │Charlie│
└───────┴───────┴───────┴───────┘
 f⍳8
0 1 2 3 4 5 6 7
1 2 3 4 5 6 7 0
2 3 4 5 6 7 0 1
3 4 5 6 7 0 1 2
4 5 6 7 0 1 2 3
5 6 7 0 1 2 3 4
6 7 0 1 2 3 4 5
7 0 1 2 3 4 5 6
Source Link
Adám
  • 31.8k
  • 4
  • 131
  • 292
Loading

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