Sha256: d9e14bba056add178ac061d3d8539b7846ee018d0c3ea599c5479a165e100ea2

Contents?: true

Size: 1.67 KB

Versions: 45

Compression:

Stored size: 1.67 KB

Contents

# Transpose

Given an input text output it transposed.

Roughly explained, the transpose of a matrix:

```text
ABC
DEF
```

is given by:

```text
AD
BE
CF
```

Rows become columns and columns become rows. See <https://en.wikipedia.org/wiki/Transpose>.

If the input has rows of different lengths, this is to be solved as follows:

- Pad to the left with spaces.
- Don't pad to the right.

Therefore, transposing this matrix:

```text
ABC
DE
```

results in:

```text
AD
BE
C
```

And transposing:

```text
AB
DEF
```

results in:

```text
AD
BE
 F
```

In general, all characters from the input should also be present in the transposed output.
That means that if a column in the input text contains only spaces on its bottom-most row(s),
the corresponding output row should contain the spaces in its right-most column(s).

## Running tests

Execute the tests with:

```bash
$ elixir transpose_test.exs
```

### Pending tests

In the test suites, all but the first test have been skipped.

Once you get a test passing, you can unskip the next one by
commenting out the relevant `@tag :pending` with a `#` symbol.

For example:

```elixir
# @tag :pending
test "two characters in a row" do
  input= "AB"
  expected =
    "A\n" <>
    "B"

  assert Transpose.transpose(input) == expected
end
```

Or, you can enable all the tests by commenting out the
`ExUnit.configure` line in the test suite.

```elixir
# ExUnit.configure exclude: :pending, trace: true
```

For more detailed information about the Elixir track, please
see the [help page](http://exercism.io/languages/elixir).

## Submitting Incomplete Solutions
It's possible to submit an incomplete solution so you can see how others have completed the exercise.

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
trackler-2.2.1.91 tracks/elixir/exercises/transpose/README.md
trackler-2.2.1.90 tracks/elixir/exercises/transpose/README.md
trackler-2.2.1.89 tracks/elixir/exercises/transpose/README.md
trackler-2.2.1.88 tracks/elixir/exercises/transpose/README.md
trackler-2.2.1.87 tracks/elixir/exercises/transpose/README.md
trackler-2.2.1.86 tracks/elixir/exercises/transpose/README.md
trackler-2.2.1.85 tracks/elixir/exercises/transpose/README.md
trackler-2.2.1.84 tracks/elixir/exercises/transpose/README.md
trackler-2.2.1.83 tracks/elixir/exercises/transpose/README.md
trackler-2.2.1.82 tracks/elixir/exercises/transpose/README.md
trackler-2.2.1.81 tracks/elixir/exercises/transpose/README.md
trackler-2.2.1.80 tracks/elixir/exercises/transpose/README.md
trackler-2.2.1.79 tracks/elixir/exercises/transpose/README.md
trackler-2.2.1.78 tracks/elixir/exercises/transpose/README.md
trackler-2.2.1.77 tracks/elixir/exercises/transpose/README.md
trackler-2.2.1.76 tracks/elixir/exercises/transpose/README.md
trackler-2.2.1.75 tracks/elixir/exercises/transpose/README.md
trackler-2.2.1.74 tracks/elixir/exercises/transpose/README.md
trackler-2.2.1.73 tracks/elixir/exercises/transpose/README.md
trackler-2.2.1.72 tracks/elixir/exercises/transpose/README.md