Re: Collections module for ESL

new topic     » goto parent     » topic index » view thread      » older message » newer message

Gordon Webster wrote:
> 
> I would like to suggest a 'collections.e' module for the ESL.
> 
> I think it would be extremely useful to have hash tables, sets,
> record tables etc.
> 
> Hash tables would be implemented as sets of key/value pairs e.g. ...
> {"name","age","eye color",{"Joe Bloggs",54,"blue"))
> 
> Sets would be sequences that could not contain duplicate values and
> would ignore attempts to 'append', 'prepend' or otherwise insert any
> duplicates values
> 
> Record tables would be for large 'arrays' of identical records whose
> fields are designated by their position in the record (I use this
> kind of functionality very often, when a full DB solution would be
> overkill). They could look like this ...
> {"name","age","eye color",{{"Joe Bloggs",54,"blue"),{"Fred X",41,"green"} ...
> }
> 
> Gordon
> 
We'll definitely have all or most of those but maybe we should put them all in
different files.

I expect that we'll have a few advanced data type modules for the standard
variety of structures that most programmers use.

So how about:
  queue.e
  stack.e
  hash.e
  set.e
  record.e

Personally, for record I prefer to have an n-length sequence record where the
first is a list of field names and the second is the data for each field.

{ {"name","age","eye color"},
  {"Joe Bloggs",54,"blue"}
  {"Fred X",41,"green"},
  ... }

So to get the value for "name" from everyone you just do a find(s[1], "name")
and use the result in all the sequences after the first.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu