First first contact with Elixir

Good Morning!
First first contact with Elixir.

I’m accessing and having my first contact with elixir through the website elixirschool.com

I just tested:
Enum.chunk_every([1,2,3,4,5,6], 2)

-> [[1, 2], [3, 4], [5, 6]]

Doubt:
Enum.chunk_every([1,2,8,9,5,6], 2)

-> [[1, 2], ‘\b\t’, [5, 6]]

I thank you for your help.

1 Like

Hello and welcome,

It is the first trick You need learn in Elixir, [8, 9] is strictly equal to ‘\b\t’, but different representation.

‘’ is for charlist, or list of char :slight_smile:

Thank you very much.

What should i do to get [[1,2], [8,9], [5,6]] ?

Hello, my first moments in the forum as well, take a look at this documentation link https://elixir-lang.org/getting-started/binaries-strings-and-char-lists.html#charlists

1 Like

You can inspect like this…

IO.inspect [[1,2], [8,9], [5,6]], charlists: :as_lists
[[1, 2], [8, 9], [5, 6]]

Thank you!

I will leave the sequence and read about charlist.

Thank you!
I just changed the reading sequence and found that solution.

Thank you for your help.

[72, 101, 108, 108, 111, 32, 97, 110, 100, 32, 119, 101, 108, 99, 111, 109, 101]

:slight_smile:

6 Likes

:slight_smile:

1 Like