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

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
LegitStack
I’m hoping you guys can give me some general advice and perhaps code examples if you’re feeling up to it. I’m very interested in Elixir,...
New
New
quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
makeitrein
Hey all, just started picking up Elixir last week and am writing a scraper as a learning project. Baby step #1 is extracting the number ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
beno
I will often find my self writing things similar to: case some_value do nil -&gt; something() "" -&gt; something() _ -&gt; someth...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New

Other popular topics Top

peerreynders
Manning 2016 Halloween weekend sale via Deal of the Day Friday, October 28 - Half off all MEAPs - code WM102816LT Saturday, October 29 ...
326 29600 154
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
sergio
I couldn’t find any guides that worked well with Phoenix 1.6.0 and esbuild. I hope this helps people test the waters and eases you into t...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 49522 488
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement