sribe
-
In my work with Elixir, one of the few things that I’ve really found missing is an efficient FIFO.
-
Do others agree with the need?
-
If so, and if no one else is working on it then I’ll volunteer to wrap Erlang’s queue class into an Elixir-idiomized Queue.
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
Hey there,
It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
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
Quite interesting article Google brought me. Didn’t find any mentions about it here.
What do you think in general? Would you use togethe...
New
:warning: Security advisory: Decimal DoS vulnerability
A vulnerability has been published for decimal where very large exponents can cau...
New
It would be helpful to have a list of companies worldwide that hire engineers without prior experience in Elixir. Often, it can be quite ...
New
What IDE or editor are you using for Elixir development?
Personally, I use Zed, and I really like it, but sometimes I wish there were a ...
New
Other Trending Topics
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
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
- #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
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #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)
OvermindDL1
I usually just make my own zipper for that, it’s a simple 2-tuple that allows efficient ‘rear’ (and front technically) insertion as well as efficient ‘front’ (and rear technically) popping with an occasional
:lists.reverse()flipping.sribe
Yeah, the list.reverse hacks are great when you’re dealing with short queues. I’ve come across the one project now where I’m dealing with longer queues and I don’t want to do that.
(I’m assuming I’m understanding what you’re doing here… But since I’ve never actually implemented that, maybe I’m imagining it to be worse performing than it is.)
OvermindDL1
It is just a 2-tuple like:
And the
reversefunction is VERY fast, it is not a usual bottleneck anyway even with large lists.peerreynders
I ran into queue in the GenStage documentation - and as such I don’t see a big issue with using Erlang libraries directly when they are not exposed through Core Elixir (possibly adapted through a super thin wrapper tailored to the specific use case without covering the full capability).
I think Elixir developers should embrace the Erlang libraries - not hide them away.
michalmuskala
The
:queuemodule is the answer. It works on the same principle that @OvermindDL1 described.sribe
Yes, I was asking about wrapping it…
NobbZ
I think that aside from the primitives which are already wrapped in
:elixir-application, the most idiomatic way to wrap erlang modules and libraries is to use them directly.sribe
I disagree. The native queue library cannot be used in a pipeline; its use, to me, sticks out as very non-idiomatic elixir.
Qqwy
I agree that
:queueis not nice to pipe, and also not nice to intropect.Its implementation itself, as a purely functional queue à la Okasaki, is wonderful.
I have used EQueue in the past, which is an Elixir wrapper around
:queue.I am unsure about my opinion of needing a queue inside of the standard library. FIFO queues are not used that often in functional programming (at least in the projects I have worked on). The most important one, the actor model message mailbox, is abstracted away from us.
I do wonder how a queue NIF would look like, though :D.
rvirding
There is one serious issue with the
If you are going to do an elixir
:queuemodule and that is that there 3 interfaces to the module, which makes it a right mess. Keeping track of which is which is a problem.Queuemodule then pick one and stick with it.If you do your own elixir
Queuethere is really no reason to interface the erlang one as the implementation part is so straight forward it is probably less code to do it yourself. I needed a queue with bounded length and found it easier to write it directly myself rather than put a wrapper aroundqueue.