mmport80
Unique StreamData Result Generation
I am generating a list of atoms which looks like this,
[:c, :u, :d]
|> StreamData.one_of()
|> StreamData.list_of()
…
A little more logic to it, but it generates this:
[[:c], [:c, :c, :u], [:c, :u, :u, :c], [:c], [:c, :d, :c], [:c, :c, :d],
[:c, :d, :c, :u, :d, :c, :d], [:c, :d, :c, :u], [:c, :d, :c],
[:c, :c, :u, :d, :d, :c, :u, :u, :u, :c, :d], [:c, :c, :c], …
Any way to ensure no dupes are generated?
Suspect the best way is with Enum?
E.g. [:c] is closely followed by [:c].
Not a big deal, just wondering, if it can be done in StreamData itself..
Most Liked
sneako
mmport80
I thought so also, but afaict, it ensures the elements of each individual list are unique, i.e. not
[:a, :a]
Rather than not
[[:a, :b], [:a, :b]]
1
Last Post!
dimitarvp
Nothing prevents you from making a generator that produces one such atom list and then compose it through uniq_list_of on a higher level. Unless I misunderstood you.
0
Popular in Questions
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
Hi everyone!
I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
Good day to you all.
I have been struggling to get a query involving like and ilike to work.
Can anyone assist me on this, please?
pro...
New
i’m a new one to elixir
which editor can i use
vs code? or atom?
Thanks! :smiley:
New
Other popular topics
Hi!
In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir?
Searched the docs for ip address and the web, no good results.
Thanks!
New
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set?
Thanks.
New
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
New
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible.
total = 10
while total != 0
...
New
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
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
- #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










