>
> On Sunday, September 25, 2016 at 8:54:50 AM UTC+10, Eric G wrote:
>>
>> - Is it better to use Dicts as the basic 'table' structure, if frequently
>> rendering lists of items filtered and sorted in various ways? In short, is
>> it better to convert a `List (ID, Item)` to a Dict for finding
If the random access happens only on user input, ie it's not something you
need to do several thousands times per second, stick to Lists.
If you need a particular sorting order, stick to Lists.
You can use `Dict.foldl/r` to map a dictionary to a list in a single step,
rather than first
Thanks for this question and the suggestions - very useful to issues I am
dealing with now.
Some questions:
- Is it better to use Dicts as the basic 'table' structure, if frequently
rendering lists of items filtered and sorted in various ways? In short, is
it better to convert a `List (ID,
I tend to model things like this with Dicts, Sets, and a type alias for
each identifier. So, something like
type alias Model =
{ artists : Dict ArtistId Artist
, albums : Dict AlbumId Album
}
type alias ArtistId =
Int
type alias Artist =
{ id : ArtistId
, name : String
, albums
I'm writing a real time strategy game and I'm using numeric ids on
everything.
For example, each unit has an Id, and the command to attack another unit
contains the target unit id.
I keep all units in a (Dict UnitId Unit), so I can access each quickly.
It's not as handy (or fast) as having
On Friday, September 23, 2016 at 9:44:47 AM UTC+1, Rupert Smith wrote:
>
> type Album =
> Album { name : String, artists : Maybe List Artist }
> | Reference String
>
> type Artist =
> Artist { name : String, albums : Maybe List Album }
> | Reference String
>
Would also make the ids
On Thursday, September 22, 2016 at 11:24:38 PM UTC+1, Dénes Harmath wrote:
>
> in a typical model, there are cross-references: e.g. we have artists and
> albums, and the album refers to its artist. How do we model this in Elm? A
> possible approach is giving unique identifiers to objects and