Letter Interpolate

2

This is a fairly simple challenge. Given a lower-case word, you must "interpolate" between letters. Here's some examples to hopefully clarify this:

Input: test Output: tsrqponmlkjihefghijklmnopqrst

Between letters you must add, in alphabetical order, the letters between those two letters. So if you have ad, you must output abcd. If you are given da, you must output dcba.

If the letters are next to each other in the alphabet, nothing happens:

Input: hi Output: hi

Assume the input contains a lower-case word consisting of ASCII letters only; no spaces, symbols, etc. The input is also never empty.

Lowest byte count wins; this is code-golf. If you have any questions please comment.

MCMastery

Posted 2017-01-30T17:49:32.610

Reputation: 783

Question was closed 2017-01-30T18:06:58.447

3What is the output for too? tsrqpo, tsrqpoo, tsrqpooo, something else? – Jonathan Allan – 2017-01-30T17:54:49.870

4Duplicate? (numbers instead of characters). – nimi – 2017-01-30T17:58:59.613

I agree that it's a duplicate - converting between ASCII characters and numbers is a minor difference. – Mego – 2017-01-30T18:06:46.337

Unless McMastery clarifies on Jonathan's question and there is some significant difference regarding that – Luis Mendo – 2017-01-30T18:08:25.680

Answers

2

05AB1E, 4 bytes

ÇŸçJ

Try it online!

Honestly? I don't know why this works.

Ç    # Push characters as ASCII.
 Ÿ   # Supposed to be range from [a, .., b], apparently vectorizes on lists...
  çJ # Turn back into characters, join stack.

Magic Octopus Urn

Posted 2017-01-30T17:49:32.610

Reputation: 19 422

1I've seen this use for Ÿ before. It's a pretty cool feature – ETHproductions – 2017-01-30T18:03:01.413

It's mis-documented slightly, hence my surprise :P. Ÿ 24 = pop a,b push [a, ..., b] – Magic Octopus Urn – 2017-01-30T18:16:29.280