elbasti
Hi folks, I’ve been running into some very strange behavior that has me knocking my head against the wall.
If I run the following code:
["42", "12", "15"]
|> Enum.map(&(String.to_integer(&1)))
I get what you’d expect: the list [42, 12, 15]
But if I run this code:
["41", "92", "73", "84", "69"]
|> Enum.map(&(String.to_integer(&1)))
I get this weird string: ~c")\\ITE"
In fact, if I run just this:
["41"]
|> Enum.map(&(String.to_integer(&1)))
I get ~c")"
What on earth is going on?!
I figured “maybe there’s some unicode strageness going on with LiveBook” so I tried it in iex, with the same results:
Trending in Questions
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
Hello,
I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind.
However, when I launch mix phx.server, I get an error...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
I’m working on a small exercise involving update_in/3, and I came up with this solution:
data = %{
name: "Periodic Table",
category:...
New
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication):
toke...
New
Is there any way to avoid the Hologram compiler running when using iex? It seems like the front-end code could potentially be disregarded...
New
** (ArgumentError) expected :max_attempts to be a positive integer, got: {:@, [line: 10, column: 19], [{:max_attempts, [line: 10, column:...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex












Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
outlog
congrats on reaching this milestone - and completing a major step/rite of passage on your elixir journey - it’s a charlist Binaries, strings, and charlists — Elixir v1.21.0-dev
we have all been there - and gone through the same wtf etc.
mindok
Try this to force lists of integers to display as lists of integers (reference: Inspect.Opts — Elixir v1.12.3):
stevensonmt
That this is not the default is a little crazy to me.
kokolegorille
It is a tribute to the Erlang community
dimitarvp
Yeah, you are basically seeing the runtime trying to be a bit too helpful – if a list of integers looks like a list of printable characters, then the REPL will instead show them as a printable string. The data is still there and is still the same.
If you want to get rid of that behavior in your project, just create an
.iex.exsfile at the root of your project and put this in there:Restart your
iexsession and, et voila:stevensonmt
The problem I run into is that it does not apply to any
IO.inspectcalls within the code. You have to remember to doIO.inspect(number_list_that_isnt_supposed_to_be_chars, charlists: :as_lists)every time you might be faced with this weirdness.Aetherus
I think it’s time to make
charlists: :as_liststo be a default option, and deprecate thecharlists: :inferoption.LostKobrakai
I think that would just surface how often we actually run into charlists when interacting with erlang libraries. E.g. hardly any elixir app doesn‘t use gen_tcp somewhere.
From my personal experience I‘ve been hitting the case of needing to see the underlying list of integers mostly in tests or puzzles, where there is time and opportunity to deal with the printed formatting. Not optimal, but fine.
Interacting with actual charlists on the other hand comes up when you‘re debugging some production issue and trying to dig deeper into some failure, where you don‘t want to deal with first setting up useful formatting rules to be able to understand what the system is trying to provide in information.
fuelen
Hehe
I was right here
Adzz
At least now there is the chance that someone can look up the documentation for the
~csigil. Just because it didn’t happen in this case it does not mean it’s not an improvement.