The first, the last, and everything between
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
Given two integers, output the two integers, and then the range between them:
Examples:
Input Output
0, 5 -> [0, 5, 1, 2, 3, 4]
-3, 8 -> [-3, 8, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7]
4, 4 -> [4, 4]
4, 5 -> [4, 5]
8, 2 -> [8, 2, 7, 6, 5, 4, 3]
-2, -7 -> [-2, -7, -3, -4, -5, -6]
code-golf
add a comment |Â
up vote
1
down vote
favorite
Given two integers, output the two integers, and then the range between them:
Examples:
Input Output
0, 5 -> [0, 5, 1, 2, 3, 4]
-3, 8 -> [-3, 8, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7]
4, 4 -> [4, 4]
4, 5 -> [4, 5]
8, 2 -> [8, 2, 7, 6, 5, 4, 3]
-2, -7 -> [-2, -7, -3, -4, -5, -6]
code-golf
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Given two integers, output the two integers, and then the range between them:
Examples:
Input Output
0, 5 -> [0, 5, 1, 2, 3, 4]
-3, 8 -> [-3, 8, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7]
4, 4 -> [4, 4]
4, 5 -> [4, 5]
8, 2 -> [8, 2, 7, 6, 5, 4, 3]
-2, -7 -> [-2, -7, -3, -4, -5, -6]
code-golf
Given two integers, output the two integers, and then the range between them:
Examples:
Input Output
0, 5 -> [0, 5, 1, 2, 3, 4]
-3, 8 -> [-3, 8, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7]
4, 4 -> [4, 4]
4, 5 -> [4, 5]
8, 2 -> [8, 2, 7, 6, 5, 4, 3]
-2, -7 -> [-2, -7, -3, -4, -5, -6]
code-golf
code-golf
edited 5 mins ago
asked 31 mins ago


TFeld
13k2836
13k2836
add a comment |Â
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
1
down vote
Ruby, 33 bytes
->a,b[a,b]
Try it online!
add a comment |Â
up vote
1
down vote
05AB1E, 4 bytes
Ÿ¦¨«
Try it online!
Explanation
Ÿ # inclusive range [a ... b]
¦¨ # remove the first and last element
« # append to input
add a comment |Â
up vote
1
down vote
Japt, 8 bytes
cUrõ ÅÔÅ
Try it here
@TFeld: Fixed it
– Shaggy
11 mins ago
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Ruby, 33 bytes
->a,b[a,b]
Try it online!
add a comment |Â
up vote
1
down vote
Ruby, 33 bytes
->a,b[a,b]
Try it online!
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Ruby, 33 bytes
->a,b[a,b]
Try it online!
Ruby, 33 bytes
->a,b[a,b]
Try it online!
edited 16 mins ago
answered 22 mins ago
G B
7,3961327
7,3961327
add a comment |Â
add a comment |Â
up vote
1
down vote
05AB1E, 4 bytes
Ÿ¦¨«
Try it online!
Explanation
Ÿ # inclusive range [a ... b]
¦¨ # remove the first and last element
« # append to input
add a comment |Â
up vote
1
down vote
05AB1E, 4 bytes
Ÿ¦¨«
Try it online!
Explanation
Ÿ # inclusive range [a ... b]
¦¨ # remove the first and last element
« # append to input
add a comment |Â
up vote
1
down vote
up vote
1
down vote
05AB1E, 4 bytes
Ÿ¦¨«
Try it online!
Explanation
Ÿ # inclusive range [a ... b]
¦¨ # remove the first and last element
« # append to input
05AB1E, 4 bytes
Ÿ¦¨«
Try it online!
Explanation
Ÿ # inclusive range [a ... b]
¦¨ # remove the first and last element
« # append to input
answered 14 mins ago


Emigna
44.4k431135
44.4k431135
add a comment |Â
add a comment |Â
up vote
1
down vote
Japt, 8 bytes
cUrõ ÅÔÅ
Try it here
@TFeld: Fixed it
– Shaggy
11 mins ago
add a comment |Â
up vote
1
down vote
Japt, 8 bytes
cUrõ ÅÔÅ
Try it here
@TFeld: Fixed it
– Shaggy
11 mins ago
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Japt, 8 bytes
cUrõ ÅÔÅ
Try it here
Japt, 8 bytes
cUrõ ÅÔÅ
Try it here
edited 11 mins ago
answered 17 mins ago


Shaggy
17.7k21663
17.7k21663
@TFeld: Fixed it
– Shaggy
11 mins ago
add a comment |Â
@TFeld: Fixed it
– Shaggy
11 mins ago
@TFeld: Fixed it
– Shaggy
11 mins ago
@TFeld: Fixed it
– Shaggy
11 mins ago
add a comment |Â
Â
draft saved
draft discarded
Â
draft saved
draft discarded
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f175485%2fthe-first-the-last-and-everything-between%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password