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
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. ![]()
![]()
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









