Re: Range and poolTask

2016-06-06 Thread moechofe via Digitalmars-d-learn
On Monday, 6 June 2016 at 11:25:00 UTC, Rene Zwanenburg wrote: Could you elaborate a bit? Yes. I have an InputRange and need to pass it throughout a couple of iteration and manipulation functions such as filter, map and finishing by grouping with fold. Like: myrange .filter!xxx

Re: Range and poolTask

2016-06-06 Thread moechofe via Digitalmars-d-learn
On Monday, 6 June 2016 at 09:38:32 UTC, Rene Zwanenburg wrote: http://dlang.org/phobos/std_parallelism.html#.TaskPool Or, more specifically, http://dlang.org/phobos/std_parallelism.html#.TaskPool.amap http://dlang.org/phobos/std_parallelism.html#.TaskPool.map The functions passed to map or

Range and poolTask

2016-06-06 Thread moechofe via Digitalmars-d-learn
I wonder if it is possible to write something like this: --- // taskPool.distribute -- take a range and distribute entries to different threads. dirEntries().distribute(function(R1,R2)(R1 from,R2 to){ from .filter!xxx .map!yyy .tee!zzz(to); }) .each!www; --- This

Re: missing data with parallel and stdin

2016-05-23 Thread moechofe via Digitalmars-d-learn
On Monday, 23 May 2016 at 14:16:13 UTC, Jack Stouffer wrote: Sounds like a data race problem. Use a lock on the file write operation and see if that helps. Like this?: synchronized(mutex) copy(source,dest); That didn't solve anything. What I observe is: when the process is slower, more

missing data with parallel and stdin

2016-05-23 Thread moechofe via Digitalmars-d-learn
Hi, I write a script that take a list of files from STDIN, compute some stuff, and copy files with a new names. I got 33k lines at input but got only 3k-5k in the destination folder. This is not append if I remove the .parallel() function. What did I do wrong? void delegate(string

Re: Call a function passed as template parameter.

2015-09-04 Thread moechofe via Digitalmars-d-learn
On Thursday, 3 September 2015 at 13:16:41 UTC, Adam D. Ruppe wrote: http://arsdnet.net/dcode/book/chapter_08/11/caller.d https://github.com/adamdruppe/arsd/blob/master/jsvar.d#L608 Thank you for these examples.

Call a function passed as template parameter.

2015-09-03 Thread moechofe via Digitalmars-d-learn
Hi, I would like to create a template that take a function as template parameter, create an arguments list for it, fill it with some data and call the function. void foo(uint a, string b) { // ... } void bar(long a, long b, string c) { // ... } call(alias F)(JSONValue j) { // create

n00b problem with deimos.openssl AES_cbc_encrypt

2014-05-30 Thread moechofe via Digitalmars-d-learn
Hi, I'm try to encrypt a string with AES_cbc_encrypt using the openssl bindings from https://github.com/D-Programming-Deimos/openssl And the result I got is wrong. --- ubyte[32] key // ...fill key ubyte[16] iv; // ...fill iv; AES_KEY aes_key;