MiguelHerrerai1

MiguelHerrerai1

Enum.chunk_every gives me strange lists

Hi, I’m using chunk_every for spliting a list in n sublists, and it does do so. But when i use that sublist, some strange lists apear too.

:binary.split([“e|-------5-7-----7-8-----8-2-----2-0-------0-0-----------|”, “B|-----5-----5-------5-------3-------1—1-----1—0-1-1-|”, “G|—5---------5-------5-------2-------2---------2-------|”, “D|-7-----------------------------------------------------|”, “A|-------------------------------------------------------|”, “E|-------------------------------------------------------|”], [“ÒÇÇ”, “Ôüƒ”, “ÔÇ®”, “ÔÇ¿”, “ÔÇÇ”, “ÔÇü”, “ÔÇé”, “ÔÇâ”, “ÔÇä”, “ÔÇà”, “ÔÇå”, “ÔÇê”, “ÔÇë”, “ÔÇè”, “ßÜÇ”, <<194, 133>>, " ", “\t”, “\n”, “\v”, “\f”, “\r”], [:global, :trim_all])

This is the error I’m getting and the lists that i don’t know why are appearing are:

[“ÒÇÇ”, “Ôüƒ”, “ÔÇ®”, “ÔÇ¿”, “ÔÇÇ”, “ÔÇü”, “ÔÇé”, “ÔÇâ”, “ÔÇä”, “ÔÇà”, “ÔÇå”, “ÔÇê”, “ÔÇë”, “ÔÇè”, “ßÜÇ”, <<194, 133>>, " ", “\t”, “\n”, “\v”, “\f”, “\r”]

[:global, :trim_all])

I don’t know if anyone knows why this is happening. Thank you

Most Liked

aziz

aziz

It’s a bit confusing to be honest, because the title mentions Enum.chunk_every but the problem seems to be the call to :binary.split/3. The thing is you can’t pass a list to :binary.split as the first argument, it expects a binary. Besides, why not use String.split/3? Should work the same.

I have no clue how you get that second “strange” list and why you’re using it as a list of split patterns…
Please explain a bit more and try to use code tags. :slight_smile::+1:

Where Next?

Popular in Questions Top

joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

Other popular topics Top

KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36820 110
New
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

We're in Beta

About us Mission Statement