sabo66
Hello I’m new in Elixir, it is possible to assign a global variable from a local scope ?
ex
case x do
"text" -> global_var = 1
end
Trending in Discussions
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
New
The obligatory hello world thread!
Who are you and where are you from? :stuck_out_tongue:
New
I want to open this thread for you all to discuss and help those who really like Ash but are still hesitant to use it in a real project. ...
New
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog
It says that Fly is going all-in on sprites, which is a worry ...
New
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using.
We’re particularly inte...
New
Is there a word for the ~> symbol used in Version strings?
Do you also just call it a Squiggle Arrow™ ?!
New
Other Trending Topics
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Aludel - LLM Evaluation Workbench
Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New
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
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
dimitarvp
What problem are you looking to solve?
There are many better ways compared to using global variables.
sabo66
I’m parsing a CSV file and I would set a global state when catch a specific CSV line
dimitarvp
That seems unnecessary. Can you post an excerpt from the CSV file and tell us what you are trying to do with it exactly? Like why would you need global state in the first place.
sabo66
Ok, for exemple I have
I would to memorise the “A” in the first line because he is not include in the next lines 2, 3, … and need to memorise this information for make insert in Database %{letter: x, number: y}
dimitarvp
That’s an incomplete example.
Then we would be able to help.
sabo66
file.csv (~2000 lines)
I would capture the informations for when the length of the key is > 1 like this
%{letter: previous_letter, number: number, text: text}
ex
for the line 2 %{letter: “A”, number: 01, text: “Culture et production animale, chasse et services annexes”}
for the line 1 %{letter: “A”, number: nil, text: “AGRICULTURE, SYLVICULTURE ET PÊCHE”}
LostKobrakai
Sounds like a usecase for
Enum.chunk_whileor theStream.chunk_whilecounterpart.sabo66
I will take a look thank you
dimitarvp
So B is parent of 05? And C is parent of 10?
sabo66
Yes, each line or number (with length > 1) is child of the closest previous letter