Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #74497

Re: The C Containers library

From Melzzzzz <mel@zzzzz.com>
Newsgroups comp.lang.c
Subject Re: The C Containers library
Date 2015-10-31 22:04 +0100
Organization albasani.net
Message-ID <20151031220421.263e7c82@maxa-pc> (permalink)
References <n11san$o70$1@dont-email.me> <n12m8n$ere$1@dont-email.me> <20151031163338.78f085fa@maxa-pc> <fc5089c0-2d99-46b7-a0b4-4fa18bfdabd4@googlegroups.com>

Show all headers | View raw


On Sat, 31 Oct 2015 11:51:05 -0700 (PDT)
Malcolm McLean <malcolm.mclean5@btinternet.com> wrote:

> On Saturday, October 31, 2015 at 3:33:47 PM UTC, Melzzzzz wrote:
> > 
> > What about something concrete? Like parsing CSV file and sorting on
> > eg third field in a record, placing in eg binary tree?
> >  
> I wrote a csv parser a while ago.
> 
> But it trades quite a lot of efficiency for convenience. That wasn't
> likely to be a problem for what I wanted it for - the files
> represented scientific data which, while collected automatically,
> still took substantial time to generate (you get about 10,000 samples
> per experiment, but each experiment would to take at least a day to
> set up and run, so you're not going to stress a modern desktop
> system).
> 
> The parser has no facilities for sorting on a field. So you'd
> extract the data to a  structure and sort, then convert back to
> CSV if that was the output you wanted. 
> 
> So in running a C++ vs C test, what question are you trying to
> answer?
> 

I wanted to see how much effort requires container library for such
task. eg, in d it is this:

dict_t parseFeedFile(string fileName) {
	dict_t rc;
	auto f = new std.stream.File(fileName);
	foreach(record; 
           csvReader!(string[string],Malformed.ignore)(f.toString(), null,'\t')) 
        { 
           rc[record["PRODUCT_ID"]]=record;
	}
        return rc;
}

More effort in C++ as there is no csv parser in standard library. But it
is interesting to see anyway.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

The C Containers library jacobnavia <jacob@jacob.remcomp.fr> - 2015-10-31 09:00 +0100
  Re: The C Containers library Noob <root@127.0.0.1> - 2015-10-31 10:22 +0100
    Re: The C Containers library Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-10-31 02:46 -0700
    Re: The C Containers library jacobnavia <jacob@jacob.remcomp.fr> - 2015-10-31 16:41 +0100
  Re: The C Containers library Johannes Bauer <dfnsonfsduifb@gmx.de> - 2015-10-31 12:48 +0100
    Re: The C Containers library Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-10-31 12:21 +0000
      Re: The C Containers library Johannes Bauer <dfnsonfsduifb@gmx.de> - 2015-10-31 14:31 +0100
    Re: The C Containers library Noob <root@127.0.0.1> - 2015-10-31 13:35 +0100
      Re: The C Containers library Johannes Bauer <dfnsonfsduifb@gmx.de> - 2015-10-31 14:33 +0100
    Re: The C Containers library jacobnavia <jacob@jacob.remcomp.fr> - 2015-10-31 16:45 +0100
    Re: The C Containers library Keith Thompson <kst-u@mib.org> - 2015-10-31 13:46 -0700
      Re: The C Containers library Robert Wessel <robertwessel2@yahoo.com> - 2015-11-01 01:31 -0500
        Re: The C Containers library Ian Collins <ian-news@hotmail.com> - 2015-11-01 20:34 +1300
          Re: The C Containers library Robert Wessel <robertwessel2@yahoo.com> - 2015-11-01 01:38 -0500
        Re: The C Containers library Keith Thompson <kst-u@mib.org> - 2015-11-01 01:22 -0800
      Re: The C Containers library Richard Heathfield <rjh@cpax.org.uk> - 2015-11-01 09:20 +0000
        Re: The C Containers library supercat@casperkitty.com - 2015-11-01 07:51 -0800
          Re: The C Containers library gazelle@shell.xmission.com (Kenny McCormack) - 2015-11-01 15:57 +0000
          Re: The C Containers library jacobnavia <jacob@jacob.remcomp.fr> - 2015-11-01 17:41 +0100
            Re: The C Containers library gazelle@shell.xmission.com (Kenny McCormack) - 2015-11-01 16:53 +0000
            Re: The C Containers library Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-11-01 12:01 -0500
              Re: The C Containers library jacobnavia <jacob@jacob.remcomp.fr> - 2015-11-01 22:44 +0100
      Re: The C Containers library Johannes Bauer <dfnsonfsduifb@gmx.de> - 2015-11-05 11:16 +0100
        Re: The C Containers library Keith Thompson <kst-u@mib.org> - 2015-11-05 09:24 -0800
  Re: The C Containers library jacobnavia <jacob@jacob.remcomp.fr> - 2015-10-31 16:23 +0100
    Re: The C Containers library Melzzzzz <mel@zzzzz.com> - 2015-10-31 16:33 +0100
      Re: The C Containers library Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-10-31 11:51 -0700
        Re: The C Containers library Melzzzzz <mel@zzzzz.com> - 2015-10-31 22:04 +0100
    Re: The C Containers library Noob <root@127.0.0.1> - 2015-10-31 19:29 +0100
  Re: The C Containers library Keith Thompson <kst-u@mib.org> - 2015-10-31 13:40 -0700
  Re: The C Containers library "Chris M. Thomasson" <nospam@nospam.nospam> - 2015-11-01 12:09 -0800
    Re: The C Containers library jacobnavia <jacob@jacob.remcomp.fr> - 2015-11-01 22:39 +0100
      Re: The C Containers library Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-01 22:50 +0000
        Re: The C Containers library jacobnavia <jacob@jacob.remcomp.fr> - 2015-11-02 00:07 +0100
          Re: The C Containers library Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-01 23:38 +0000
  Re: The C Containers library fir <profesor.fir@gmail.com> - 2015-11-01 16:11 -0800
    Re: The C Containers library fir <profesor.fir@gmail.com> - 2015-11-02 08:15 -0800
  Re: The C Containers library fir <profesor.fir@gmail.com> - 2015-11-01 16:27 -0800
    Re: The C Containers library fir <profesor.fir@gmail.com> - 2015-11-01 16:36 -0800

csiph-web