slang-users mailing list

[2013 Date Index] [2013 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [slang-users] creating struct and list from C


Laurent Perez <laurent.perez@xxxxxxxxxx> wrote:
> Are you aware of those discussions about creating complexe structures
> [1] and lists [2] from C ?
> A public api for creating lists would certainly be useful.

Such an API was added recently to support the json module.  The API
was extended include lists, structs, and associative arrays.

> John, do you have a todo list in which some of us could pick items
> from to help you ?

I do not really have a TODO list--- I generally add functionality to
the library based upon feedback from users.  Also much of what gets
added to the interpreter comes from using it in my work.  For example,
I often write code that involves knowing the first index of the
largest element in an array.  That is, I often found myself writing
code such as

    i = where (A == max(A))[0];

So I added the wherefirstmax intrinsic function, which runs about 4
times faster than the above code:

  slsh> .load rand
  slsh> A = rand_uniform (10000000);
  slsh> tic; loop(10) i = where(A == max(A))[0]; toc;
  1.26978
  slsh> i;
  3244677
  slsh> tic; loop(10) i = wherefirstmax (A); toc;
  0.39504700000000004
  slsh> i;
  3244677

Thanks,
--John



[2013 date index] [2013 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]