MUSTDOS
Hello all!
assign(socket, :name, “Elixir”)
Why can’t we have assign/stream take a group of atoms and maps/structs as a default to reduce spamming assign/stream along with their parentheses?
I know this isn’t a perfect example of code but here’s what I cooked up but it returns a list of assigns/streams instead finalizing them
def socket_initializer(socket,initializer_list) do
socket = Enum.map(initializer_list, fn {key,value} ->
case key do
:stream ->
Enum.map(value, fn {stream_name, stream_value} ->
IO.inspect stream(socket, stream_name, stream_value)
end)
:assign ->
Enum.map(value, fn {assign_name, assign_value} ->
IO.inspect assign(socket, assign_name, assign_value)
end)
_ ->
IO.puts(to_string(key) <> " is not a valid initalizer")
end
end)
end
initializer_list = [
{ :assign , [ {:search, %Worker{}}, {:active_account_tuple , Operations.status_tuple_registration()} ] },
{ :stream , [ {:workers , %Worker{}} ] }
]
Trending in Proposals: Ideas
I’m a bit in a fuzz about this topic. I’ve worked out some sort of Dropbox feature for a specific client. This feature allows him to uplo...
New
I recently learned about this API and was surprised there’s no explicit support for it in the the Phoenix.
Example use cases:
A webs...
New
Other Trending Topics
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
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with.
But I don’t use it anymore.
Serverless was the promis...
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
- #ai
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #security
- #metaprogramming










Showing Posts 1 to 5- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
rhcarvalho
stream/4works on a single stream, butassign/2can assign multiple values at once.The one you were referring to is
assign/3which works on a single item.al2o3cr
(NOTE: spruced up the formatting of your code example using triple-backticks
```)I don’t personally see a huge difference between adding a stream by writing:
and
Your post mentions “along with their parentheses”, but the former definitely seems to have more bracketry than the latter.
MUSTDOS
VS
I just felt easier for multiple copy and pastes for bigger pages.
MUSTDOS
Sorry for multiple repeated posts; it just gave me error occurred or something for clicking reply until I refreshed
kevinschweikert
all good! i’ve cleaned up the previous posts