wildcard expansion for D args

2012-02-14 Thread Jay Norwood
Below is a code fragment I'm using to expand pathname argv args in some directory processing code. Works pretty well. Basically, I'm allowing expansion of just the basename; so strings like these below are expanded into expDir[] for each matching path in the dirname directory, which is deter

Re: wildcard expansion for D args

2012-02-14 Thread Jay Norwood
So, there are some wildargv C implementations around that can substitue for the argv initializations, which would provide argv expansion before it got to main. Are there any options for argv expansion in the D libraries. I suppose in linux this is all supplied by the shell, but in Windows it

replacement for rfind in 2.058

2012-02-19 Thread Jay Norwood
I see rfind is deprecated and std.regexp is deprecated, and no rfind in std.string, so is there some equivalent operation in std.regex?

Re: replacement for rfind in 2.058

2012-02-19 Thread Jay Norwood
On Sunday, 19 February 2012 at 18:55:21 UTC, Jay Norwood wrote: I see rfind is deprecated and std.regexp is deprecated, and no rfind in std.string, so is there some equivalent operation in std.regex? I was trying to rebuild bud wit 2.058, and so at around line 2078 I replaced the rfind by

preprocessor pass equivalent?

2012-03-15 Thread Jay Norwood
Is there some option, similar to -E gcc option, that would generate the analogous listing for D? What I mean is that I'd like to see all the code in version blocks gone, all the mixin strings expanded. It is probably too much to wish for having the infered auto's expanded...

Re: preprocessor pass equivalent?

2012-03-15 Thread Jay Norwood
On Thursday, 15 March 2012 at 10:09:25 UTC, Jacob Carlborg wrote: The Eclipse plugin, Descent, has a view that does something like this. Although I don't know how well it works for D2. It expands mixins, string mixins, replaces scope statements with try/catch/finally and other things. It als

Re: regex issue

2012-03-18 Thread Jay Norwood
On Friday, 16 March 2012 at 03:36:12 UTC, Joshua Niehus wrote: Hello, Does anyone know why I would get different results between ctRegex and regex in the following snippet? Thanks, Josh I'm also having questions about the matchers. From what I understand in the docs, if I use this greedy

Re: regex issue

2012-03-19 Thread Jay Norwood
On Monday, 19 March 2012 at 08:14:18 UTC, Dmitry Olshansky wrote: On 19.03.2012 12:05, Dmitry Olshansky wrote: In that case, I should have been able to do something like: matches=match(input,ctr); l_cnt = matches.length(); I'm curious what this length() does as I have no length for RegexMa

Re: regex issue

2012-03-19 Thread Jay Norwood
On Monday, 19 March 2012 at 08:05:18 UTC, Dmitry Olshansky wrote: Like I told in main D group it's wrong - regex doesn't only count matches. It finds slices that do match. Thus to make it more efficient, it returns lazy range that does searches on request. "g" - means global :) Then code like t

Re: regex issue

2012-03-19 Thread Jay Norwood
On Monday, 19 March 2012 at 13:27:03 UTC, Jay Norwood wrote: ok, global. So the document implies that I should be able to get a single match object with a count of the submatches. So I think maybe I've jumped to the wrong conclusion about how to use it, thinking I could just use "

Re: regex issue

2012-03-19 Thread Jay Norwood
On Monday, 19 March 2012 at 13:55:39 UTC, Dmitry Olshansky wrote: That's right, however counting is completely separate from regex, you'd want to use std.algorithm count: count(match(,"\n")); or more unicode-friendly: count(match(, regex("$","m")); //note the multi-line flag This only

Re: regex issue

2012-03-19 Thread Jay Norwood
On Monday, 19 March 2012 at 19:24:30 UTC, Jay Norwood wrote: This fails to build, so I'd guess is missing \p void wcp (string fn) { enum ctr = ctRegex!("\p{WhiteSpace}","m"); } -- Build started: Project: a7, Configuration: Release Win32 -- Building R

Re: regex issue

2012-03-20 Thread Jay Norwood
On Tuesday, 20 March 2012 at 10:28:11 UTC, Dmitry Olshansky wrote: Note that if your task is to split buffer by exactly '\n' byte then loop with memchr is about as fast as it gets, no amount of magic compiler optimizations would make other generic ways better (even theoretically). What they *co

anything that would provide support for zip filesystem?

2012-03-22 Thread Jay Norwood
In my work we have to access a big zip file with a lot of little xml files in it to look up various target specific attributes for a wide variety of targets. Basically the zip file it is a zipped up directory hierarchy of zip files, and in processing it the hierarchy has meaning. I see in t

parallel unzip in progress

2012-04-02 Thread Jay Norwood
I'm working on a parallel unzip. I started with phobos std.zip, but found that to be too monolithic. I needed to separate out the tasks that get the directory entries, create the directory tree, get the compressed data, expand the data and create the uncompressed files on disk. It currently

Re: parallel unzip in progress

2012-04-03 Thread Jay Norwood
On Tuesday, 3 April 2012 at 05:27:08 UTC, Jay Norwood wrote: .. So, to answer my own questions ... I placed the code below in a taskpool parallel foreach loop, where each am is an archive member. It is expanded, and the expanded data is written to a file. The original time info is

Re: parallel unzip in progress

2012-04-04 Thread Jay Norwood
On Wednesday, 4 April 2012 at 07:25:25 UTC, dennis luehring wrote: Am 04.04.2012 08:31, schrieb Jay Norwood: This particular loop is currently excluding restore of times on directory entries, but I suppose I can restore the directory times after all the files have been expanded into the

Re: parallel unzip in progress

2012-04-04 Thread Jay Norwood
On Wednesday, 4 April 2012 at 07:39:56 UTC, Jay Norwood wrote: On Wednesday, 4 April 2012 at 07:25:25 UTC, dennis luehring I decided to try the option where the data is stored in the zip file uncompressed. Since the folder is just over 2GB, I ran into the stdio File problems with being

Re: parallel unzip in progress

2012-04-07 Thread Jay Norwood
On Wednesday, 4 April 2012 at 19:41:21 UTC, Jay Norwood wrote: > The work-around was to convert all the file operations to use std.stream equivalents, and that worked well, but I see i the bug reports that even that was only working correctly on windows. So I'm on windows, and ok for

making ntfs do faster deletes

2012-04-15 Thread Jay Norwood
I'm trying to figure out how to achieve folder deletion times close to the times achieved with the parallel rmd after myDefrag sortByName on a folder. It takes less than 3.5 secs for a 2G layout that has been sorted, and with the rmd configured so that it also works on a sorted list. This is a

Re: making ntfs do faster deletes

2012-04-16 Thread Jay Norwood
On Monday, 16 April 2012 at 09:16:09 UTC, Kagamin wrote: Do you use FILE_FLAG_SEQUENTIAL_SCAN too? The std.file.write does use FILE_FLAG_SEQUENTIAL_SCAN void write(in char[] name, const void[] buffer) my experimental code to create the empty file also uses it, but it doesn't write any buffers

using ntfs write_through option to create an efficient unzipped layout

2012-04-21 Thread Jay Norwood
Below are measured times on operations on an unzipped 2GB layout. My observation is that use of a slightly modified version of std.file.write for the creation of the unzipped files results in a folder that is much more efficient for sequential file system operations. In particular, the ntfs rm

avoid toLower in std.algorithm.sort compare alias

2012-04-21 Thread Jay Norwood
While playing with sorting the unzip archive entries I tried use of the last example in http://dlang.org/phobos/std_algorithm.html#sort std.algorithm.sort!("toLower(a.name) < toLower(b.name)",std.algorithm.SwapStrategy.stable)(entries); It was terribly slow for sorting the 34k entries in my

Re: avoid toLower in std.algorithm.sort compare alias

2012-04-21 Thread Jay Norwood
On Saturday, 21 April 2012 at 23:54:26 UTC, Jonathan M Davis wrote: Yeah. toLower would be called on both strings on _every_ compare. And since that involves a loop, that would make the overall call to sort an order of magnitude worse than if you didn't call toLower at all. I'm not sure if it's

Re: avoid toLower in std.algorithm.sort compare alias

2012-04-21 Thread Jay Norwood
On Sunday, 22 April 2012 at 02:29:45 UTC, Jonathan M Davis wrote: Regardless of whether it's the Big(O) complexity or the constant factor that's the problem here, clearly there's enough additional overhead that it's causing problems for Jay's particular case. It's also the sort of thing that c

Re: avoid toLower in std.algorithm.sort compare alias

2012-04-22 Thread Jay Norwood
On Sunday, 22 April 2012 at 06:26:42 UTC, Jonathan M Davis wrote: You can look at the code. It checks each of the characters in place. Unlike toLower, it doesn't need to generate a new string. But as far as the comparison goes, they're the same - hence that line in the docs. - Jonathan M Dav

Re: avoid toLower in std.algorithm.sort compare alias

2012-04-22 Thread Jay Norwood
On Sunday, 22 April 2012 at 00:36:19 UTC, bearophile wrote: Performing the toLower every time the cmp function is called doesn't change the O complexity. In Phobos there is an alternative sorting (Schwartzian sorting routime) that applies a function to each item before sorting them, usually is

Re: avoid toLower in std.algorithm.sort compare alias

2012-04-23 Thread Jay Norwood
On Monday, 23 April 2012 at 11:27:40 UTC, Steven Schveighoffer wrote: I think using std.string.icmp is the best solution. I would expect it to outperform even schwartz sort. -Steve icmp took longer... added about 1 sec vs 0.3 sec (for schwartzSort ) to the program execution time. bool myC

Re: directory wildcard

2012-05-18 Thread Jay Norwood
On Friday, 18 May 2012 at 22:10:36 UTC, Arne wrote: According to: http://dlang.org/phobos/std_path.html#globMatch it is possible to use wildcards spanning multiple directories. assert (globMatch(`foo/foo\bar`, "f*b*r")); But wildcards with dirEntries() seem less powerful. `c:\partial*\path\*.

Re: ProjectEuler problem 35

2012-05-19 Thread Jay Norwood
On Wednesday, 16 May 2012 at 09:26:45 UTC, Tiberiu Gal wrote: hi many claim their code solves the problem in order of ms ( c/pascal/haskell code) I used the blockwise parallel sieve described here, and measured nice speed-ups as described in his blog. It completes calculations within an

Re: ProjectEuler problem 35

2012-05-20 Thread Jay Norwood
On Sunday, 20 May 2012 at 15:48:31 UTC, Stewart Gordon wrote: On 19/05/2012 16:13, maarten van damme wrote: Yes, that's a common optimisation. Faster still would be to test 6k-1 and 6k+1 for each positive integer k. Indeed, I've done more than this in my time: hard-coded all the primes up to

ufcs and integer params

2012-07-14 Thread Jay Norwood
I was looking at the xtend example 4 Distances here, and see that their new generation capability includes ability to do 3.cm 10.mm , and these result in calls to cm(3) and mm(10). http://blog.efftinge.de/ I see that similar capability was discussed for D previously at the link below. Ho

Re: ufcs and integer params

2012-07-14 Thread Jay Norwood
I see from this other discussions that it looks like 2.059 ( or maybe 2.060) does support something like 3.cm(). Not sure from the discussion if it would also accept 3.cm as in the xtext/xtend example. http://forum.dlang.org/thread/smoniukqfxerutqrj...@forum.dlang.org

Re: Coping files and folders

2013-01-24 Thread Jay Norwood
On Thursday, 24 January 2013 at 07:41:23 UTC, Jacob Carlborg wrote: Someone posted code in these newsgroups of a parallel implementation of copy and remove. I posted a parallel implementation a while back, and also put it on github. The parallel trick is to create the folder structure firs

Re: Coping files and folders

2013-01-25 Thread Jay Norwood
I also wrote a copy version that orders file sequence on disk efficiently, using write through, and posted it. This speeds up any subsequent file system operations done in the directory order as if you have done a defrag. Great for hard drives, but not needed for ssd. https://github.com/jnor

function declaration in parameter list

2013-04-30 Thread Jay Norwood
On Saturday, 6 April 2013 at 14:50:50 UTC, Bruno Medeiros wrote: Interesting thread. I've been working on a hand-written D parser (in Java, for the DDT IDE) and I too have found a slew of grammar spec issues. Some of them more serious than the ones you mentioned above. In same cases it's actual

Re: Stop to! rounding?

2013-07-03 Thread Jay Norwood
On Wednesday, 3 July 2013 at 08:23:40 UTC, monarch_dodra wrote: On Wednesday, 3 July 2013 at 06:18:28 UTC, Jonathan M Davis wrote: On Wednesday, July 03, 2013 08:11:50 Josh wrote: Long story short, I think both would be a great addition to phobos/D. I'd personally really want to play with dec

D language manipulation of dataframe type structures

2013-09-24 Thread Jay Norwood
I've been playing with the python pandas app enables interactive manipulation of tables of data in their dataframe structure, which they say is similar to the structures used in R. It appears pandas has laid claim to being a faster version of R, but is doing so basically limited to what they c

Re: D language manipulation of dataframe type structures

2013-09-25 Thread Jay Norwood
While the interactive exploratory aspects of the pandas are attractive, in my case the interaction has just been a crutch to discover how to correctly use their api. Once through that api learning curve, I'd mainly be interested in repeating the operations that worked correctly. The executio

Comma operator overloading

2013-11-17 Thread Jay Norwood
I'm reading a SystemC lecture which describes use of operator overloading of comma in their syntax to support concatenation. So, for example, they support the data operations below sc_uint<4> a, b, d, e; sc_unit<8> c; c = (a, b); (d, e) = c; As I understand it, SystemC is C++. I didn't find c

why necessary to specify size of zero fill for formatted write?

2013-11-28 Thread Jay Norwood
long x = 0x123456789; writef("%0x",x); prints 123456789 Seems like it has enough info to fill out to 16 hex digits...

overload of array operations

2011-10-14 Thread Jay Norwood
Is it possible to overload array operations

Re: overload of array operations

2011-10-14 Thread Jay Norwood
Jonathan M Davis Wrote: > On Friday, October 14, 2011 11:30:25 Jay Norwood wrote: > > Is it possible to overload array operations > > Please be more specific. Are you asking whether a struct or class can > overload > the indexing and slicing operators? If so, the answer

Re: overload of array operations

2011-10-14 Thread Jay Norwood
Jonathan M Davis Wrote: > On Friday, October 14, 2011 11:30:25 Jay Norwood wrote: > > Is it possible to overload array operations > > Please be more specific. Are you asking whether a struct or class can > overload > the indexing and slicing operators? If so, the answer

Re: overload of array operations

2011-10-14 Thread Jay Norwood
Jonathan M Davis Wrote: > On Friday, October 14, 2011 15:29:17 Jay Norwood wrote: > > Jonathan M Davis Wrote: > > > On Friday, October 14, 2011 11:30:25 Jay Norwood wrote: > > > > Is it possible to overload array operations > > > > > > Please be m

use of D for ropes data structures

2011-10-19 Thread Jay Norwood
can someone propose the appropriate D features or libraries that would support a native D implementation of the ropes structures described in this Sgi C++ library. http://www.sgi.com/tech/stl/Rope.html

iterate over enum name:value pairs

2013-12-07 Thread Jay Norwood
In Ali Çehreli very nice book there is this example of iterating over enum range which, as he notes, fails http://ddili.org/ders/d.en/enum.html enum Suit { spades, hearts, diamonds, clubs } foreach (suit; Suit.min .. Suit.max) { writefln("%s: %d", suit, suit); } spades: 0 he

Re: iterate over enum name:value pairs

2013-12-07 Thread Jay Norwood
Thanks. This is exactly what I was looking for. I tried this iteration below, based on the example shown in the std.traits documentation, and the int values are not what I expected, but your example works fine. http://dlang.org/phobos/std_traits.html#.EnumMembers import std.traits; void

Re: iterate over enum name:value pairs

2013-12-08 Thread Jay Norwood
I see comments about enums being somehow implemented as tuples, and comments about tuples somehow being implemented as structs, but I couldn't find examples of static initialization of arrays of either. Finally after playing around with it for a while, it appears this example below works for

Re: iterate over enum name:value pairs

2013-12-08 Thread Jay Norwood
Yes, thanks, that syntax does work for the initialization. The C syntax that failed for me was using the curly brace form shown in the following link. http://www.c4learn.com/c-programming/c-initializing-array-of-structure/ Also, I think I was trying forms of defining the struct and initializ

Re: iterate over enum name:value pairs

2013-12-08 Thread Jay Norwood
On Sunday, 8 December 2013 at 22:30:25 UTC, bearophile wrote: Try: member.writeln; Bye, bearophile yeah, that's pretty nice. module main; import std.stdio; void main() { struct Suit {string nm; int val; int val2; string shortNm;}; static Suit[5] suits = [ {"spad

Re: iterate over enum name:value pairs

2013-12-08 Thread Jay Norwood
It looks like the writeln() does a pretty good job, even for enum names. I also saw a prettyprint example that prints the structure member name, and compared its output. http://forum.dlang.org/thread/ip23ld$93u$1...@digitalmars.com module main; import std.stdio; import std.traits; void mai

Re: iterate over enum name:value pairs

2013-12-08 Thread Jay Norwood
Thanks. That's looking pretty clean. I had already tried the shorter enum names without using the with statement, and it failed to compile. I thought it might work since the struct definition already specifies the enum type for the two members. with (Suit) with (SuitShort) {

Re: iterate over enum name:value pairs

2013-12-08 Thread Jay Norwood
I notice that if Suit and SuitShort have an enum with the same name, then you still have to fully qualify the enum names when using the with statement. So, for example, if spd in SuitShort was renamed spades, the first entry in the array initialization would have to be {Suit.spades, 1, 6, Suit

Re: [OT] Re: How to read fastly files ( I/O operation)

2013-12-18 Thread Jay Norwood
On Friday, 8 February 2013 at 06:22:18 UTC, Denis Shelomovskij wrote: 06.02.2013 19:40, bioinfornatics пишет: On Wednesday, 6 February 2013 at 13:20:58 UTC, bioinfornatics wrote: I agree the spec format is really bad but it is heavily used in biology so i would like a fast parser to develop som

Re: How to read fastly files ( I/O operation)

2013-12-18 Thread Jay Norwood
On Wednesday, 13 February 2013 at 17:39:11 UTC, monarch_dodra wrote: On Tuesday, 12 February 2013 at 22:06:48 UTC, monarch_dodra wrote: On Tuesday, 12 February 2013 at 21:41:14 UTC, bioinfornatics wrote: Some time fastq are comressed to gz bz2 or xz as that is often a huge file. Maybe we nee

Re: Source code annotations alla Java

2014-01-29 Thread Jay Norwood
On Friday, 21 January 2011 at 20:50:39 UTC, Jonathan M Davis wrote: On Friday, January 21, 2011 12:36:23 Ary Manzana wrote: On 1/20/11 5:48 PM, Jacob Carlborg wrote: > On 2011-01-20 21:34, Steven Schveighoffer wrote: >> On Thu, 20 Jan 2011 15:03:55 -0500, Jacob Carlborg >> wrote: >>> On 2011-

RosettaCode factorial needs to use longs

2014-03-08 Thread Jay Norwood
http://rosettacode.org/wiki/Factorial#D to whomever is maintaining these: Need to change all ints to longs in this example to get the displayed results since the 15! result requires more than 32 bits.

Re: RosettaCode factorial needs to use longs

2014-03-08 Thread Jay Norwood
After changing to longs, I made some test loops, and on release build dmd, pc, these are the relative times I measured for the different versions of factorial in that example. So the iterative wins, and the functional style results in 4x penalty in this case. duration factorial (hnsecs)=98 d

setAttributes call error

2014-03-17 Thread Jay Norwood
I updated to 2.065, and using visualD for the build on Windows. VisualD finds this setAttributes call in file.d, but the build fails to find it in the library. Does this build for someone else? import std.file; void clrReadOnly( in char[] name) { uint oldAtt = getAttributes(name); v

Re: setAttributes call error

2014-03-17 Thread Jay Norwood
Sorry, this is my fault. I had an old installation of 2.064 still in the path.

Re: Function to print a diamond shape

2014-03-20 Thread Jay Norwood
On Friday, 21 March 2014 at 00:31:58 UTC, bearophile wrote: This is a somewhat common little exercise: Write a function Bye, bearophile I like that replicate but easier for me to keep track of the counts if I work from the center. int blanks[]; blanks.length = n; int stars[]; stars.length

Re: Function to print a diamond shape

2014-03-21 Thread Jay Norwood
This one calculates, then outputs subranges of the ba and sa char arrays. int n = 11; int blanks[]; blanks.length = n; int stars[]; stars.length = n; char ba[]; ba.length = n; ba[] = ' '; // fill full ba array char sa[]; sa.length = n; sa[] = '*'; // fill full sa array int c = n/2; // center of

Re: Function to print a diamond shape

2014-03-22 Thread Jay Norwood
The computation times of different methods can differ a lot. How do you suggest to measure this effectively without the overhead of the write and writeln output? Would a count of 11 and stubs like below be reasonable, or would there be something else that would prevent the optimizer fr

Re: Function to print a diamond shape

2014-03-22 Thread Jay Norwood
I decided to redirect stdout to nul and print the stopwatch messages to stderr. So, basically like this. import std.stdio; import std.datetime; import std.cstream; StopWatch sw; sw.start(); measured code sw.stop(); derr.writefln("time: ", sw.peek().msecs, "[ms]"); Then, windows results compa

Re: Function to print a diamond shape

2014-03-23 Thread Jay Norwood
Hmmm, looks like stderr.writefln requires format specs, else it omits the additional parameters. (not so on derr.writefln) stderr.writefln("time: %s%s",sw.peek().msecs, "[ms]"); D:\diamond\diamond\diamond\Release>diamond 1>nul time: 16[ms] time: 44[ms]

Re: Function to print a diamond shape

2014-03-23 Thread Jay Norwood
I converted the solution examples to functions, wrote a test to measure each 100 times with a diamond of size 1001. These are release build times. timon's crashed so I took it out. Maybe I made a mistake copying ... have to go back and look. D:\diamond\diamond\diamond\Release>diamond 1>nul

Re: Function to print a diamond shape

2014-03-23 Thread Jay Norwood
A problem with the previous brad measurement is that his solution creates a diamond of size 2n+1 for an input of n. Correcting the size input for brad's function call, and re-running, I get this. So the various solutions can have overhead computation time of 40x difference, depending on the i

Re: Function to print a diamond shape

2014-03-23 Thread Jay Norwood
On Sunday, 23 March 2014 at 17:30:20 UTC, bearophile wrote: The task didn't ask for a computationally efficient solution :-) So you are measuring something that was not optimized for. So there's lot of variance. Bye, bearophile Yes, this is just for my own education. My builds are using

Re: Function to print a diamond shape

2014-03-23 Thread Jay Norwood
These were the times on ubuntu 64 bit dmd. I added diamondShape, which is slightly modified to be consistent with the others .. just removing the second parameter and doing the writeln calls within the function, as the others have been done. This is still with dmd. I've downloaded ldc. Als

Re: Function to print a diamond shape

2014-03-24 Thread Jay Norwood
Very nice example. I'll test on ubuntu later. On windows ... D:\diamond\diamond\diamond\Release>diamond 1> nul brad: time: 19544[ms] printDiamond1: time: 1139[ms] printDiamond2: time: 1656[ms] printDiamond3: time: 663[ms] jay1: time: 455[ms] sergei: time: 11673[ms] jay2: time: 411[ms] diamondS

Re: Function to print a diamond shape

2014-03-24 Thread Jay Norwood
not through yet with the diamond. This one is a little faster. Appending the newline to the stars and calculating the slice backward from the end would save a w.put for the newlines ... probably faster. I keep looking for a way to create a dynamic array of a specific size, filled with the in

Re: Function to print a diamond shape

2014-03-24 Thread Jay Norwood
These were times on ubuntu. I may have printed debug build times previously, but these are dmd release build. I gave up trying to figure out how to build ldc on ubuntu. The dmd one click installer is much appreciated. brad: time: 12425[ms] printDiamond1: time: 380[ms] printDiamond2: time: 72

Re: Function to print a diamond shape

2014-03-25 Thread Jay Norwood
Interesting. I'd have thought the "extra copy" would be an overall slowdown, but I guess that's not the case. I also tried your strategy of adding '\n' to the buffer, but I was getting some bad output on windows. I'm not sure why "\n\n" works though. On *nix, I'd have also expected a doub

Re: Function to print a diamond shape

2014-03-25 Thread Jay Norwood
These are times on ubuntu. printDiamond3 was slower than printDiamond. brad: time: 12387[ms] printDiamond1: time: 373[ms] printDiamond2: time: 722[ms] printDiamond3: time: 384[ms] jay1: time: 62[ms] sergei: time: 3918[ms] jay2: time: 28[ms] diamondShape: time: 2725[ms] printDiamond: time: 19[ms

Re: Function to print a diamond shape

2014-03-25 Thread Jay Norwood
On Tuesday, 25 March 2014 at 15:31:12 UTC, monarch_dodra wrote: I love how D can achieve *great* performance, while still looking readable and maintainable. Yes, I'm pretty happy to see the appender works well. The parallel library also seems to work very well in my few experiences with it.

Re: Function to print a diamond shape

2014-03-25 Thread Jay Norwood
This is a first attempt at using parallel, but no improvement in speed on a corei7. It is about 3x slower than the prior versions. Probably the join was not a good idea. Also, no foreach_reverse for the parallel, so it requires extra calculations for the reverse index. void printDiamonde2

Re: Function to print a diamond shape

2014-03-25 Thread Jay Norwood
On Wednesday, 26 March 2014 at 04:47:48 UTC, Jay Norwood wrote: This is a first attempt at using parallel, but no improvement oops. scratch that one. I tested a pointer to the wrong function.

Re: Function to print a diamond shape

2014-03-25 Thread Jay Norwood
This corrects the parallel example range in the second foreach. Still slow. void printDiamonde2cpa(in uint N) { size_t N2 = N/2; char p[] = uninitializedArray!(char[])(N2+N); p[0..N2] = ' '; p[N2..$] = '*'; char nl[] = uninitializedArray!(char[])(1); nl[] = '\n'; ch

Re: dataframe implementations

2015-11-02 Thread Jay Norwood via Digitalmars-d-learn
On Monday, 2 November 2015 at 15:33:34 UTC, Laeeth Isharc wrote: Hi Jay. That may have been me. I have implemented something very basic, but you can read and write my proto dataframe to/from CSV and HDF5. The code is up here: https://github.com/Laeeth/d_dataframes yes, thanks. I believ

Re: dataframe implementations

2015-11-17 Thread Jay Norwood via Digitalmars-d-learn
I looked through the dataframe code and a couple of comments... I had thought perhaps an app could read in the header info and type info from hdf5, and generate D struct definitions with column headers as symbol names. That would enable faster processing than with the associative arrays, as w

Re: dataframe implementations

2015-11-18 Thread Jay Norwood via Digitalmars-d-learn
On Wednesday, 18 November 2015 at 17:15:38 UTC, Laeeth Isharc wrote: What do you think about the use of NaN for missing floats? In theory I could imagine wanting to distinguish between an NaN in the source file and a missing value, but in my world I never felt the need for this. For integers

Re: dataframe implementations

2015-11-18 Thread Jay Norwood via Digitalmars-d-learn
On Wednesday, 18 November 2015 at 18:04:30 UTC, Jay Norwood wrote: vector. I'll try to find the discussions and post the link. Here are the two discussions I recall on the julia NA implementation. http://wizardmac.tumblr.com/post/104019606584/whats-wrong-with-statistics-in-julia-a-

Re: dataframe implementations

2015-11-18 Thread Jay Norwood via Digitalmars-d-learn
One more discussion link on the NA subject. This one on the R implementation of NA using a single encoding of NaN, as well as their treatment of a selected integer value as a NA. http://rsnippets.blogspot.com/2013/12/gnu-r-vs-julia-is-it-only-matter-of.html

Re: dataframe implementations

2015-11-18 Thread Jay Norwood via Digitalmars-d-learn
On Wednesday, 18 November 2015 at 22:46:01 UTC, jmh530 wrote: My sense is that any data frame implementation should try to build on the work that's being done with n-dimensional slices. I've been watching that development, but I don't have a feel for where it could be applied in this case, sin

Re: dataframe implementations

2015-12-03 Thread Jay Norwood via Digitalmars-d-learn
On Saturday, 21 November 2015 at 14:16:26 UTC, Laeeth Isharc wrote: Not sure it is a great idea to use a variant as the basic option when very often you will know that every cell in a particular column will be of the same type. I'm reading today about an n-dim extension to pandas named xray

use of typeof to determine auto type with ndslice examples

2015-12-20 Thread Jay Norwood via Digitalmars-d-learn
I pulled down the std.experimental.ndslice examples and am attempting to build some of the examples and understand the types being used. I know don't need all these imports, but it is hard to guess which ones are needed, and the examples often don't provide them, which I suspect is a common g

Re: use of typeof to determine auto type with ndslice examples

2015-12-20 Thread Jay Norwood via Digitalmars-d-learn
import std.stdio; import std.experimental.ndslice; void main() { import std.algorithm.iteration: map; import std.array: array; import std.range; import std.traits; auto t0 = 1000.iota.sliced(3, 4, 5); pragma(msg, typeof(t0)); Slice!(3u, Result) t1 = 1000.iota.slic

Re: use of typeof to determine auto type with ndslice examples

2015-12-20 Thread Jay Norwood via Digitalmars-d-learn
On Monday, 21 December 2015 at 04:39:23 UTC, drug wrote: You can use alias Type = typeof(t0); Type t1 = 1000.iota.sliced(3, 4, 5); IIRC Result is the Voldemort type. You can think of it as a detail of implementation of ndslice that isn't intended to be used by a ndslice user directly. ok, we

Re: use of typeof to determine auto type with ndslice examples

2015-12-20 Thread Jay Norwood via Digitalmars-d-learn
So, the extra confusion of the typeof(iota) Result return goes away when slicing arrays. auto a1 = new int[100]; auto t3 = a1.sliced(3,4,5); pragma(msg,typeof(t3)); //This prints Slice!(3u, int*) Slice!(3u, int*) t4 = a1.sliced(3,4,5); // and this works ok

ndslice of an array structure member?

2015-12-21 Thread Jay Norwood via Digitalmars-d-learn
I'm trying to learn ndslice. It puzzles me why t3 compiles ok, but t4 causes a compiler error in the example below. Should I be able to slice a struct member that is an array? import std.stdio; import std.experimental.ndslice; import std.experimental.ndslice.iteration: transposed; struct samp

ndslice and limits of debug info and autocompletion

2015-12-21 Thread Jay Norwood via Digitalmars-d-learn
I'm trying to determine if the debugger autocompletion would be useful in combination with ndslice. I find that using visualD I get offered no completion to select core_ctr or epu_ctr where epu_ctr is used in the writeln below. I take it this either means that there is some basic limitation

Re: ndslice and limits of debug info and autocompletion

2015-12-21 Thread Jay Norwood via Digitalmars-d-learn
The autocompletion doesn't work here to offer epu_ctr in the writeln statement either, so it doesn't seem to be a problem with number of subscripts. writeln(a1[0]. does offer epu_ctr for completion at the same place. import std.stdio; import std.experimental.ndslice; import std.experimenta

Re: ndslice of an array structure member?

2015-12-21 Thread Jay Norwood via Digitalmars-d-learn
On Tuesday, 22 December 2015 at 01:13:54 UTC, Jack Stouffer wrote: The problem is that t3 is slicing a1 which is a dynamic array, which is a range, while t4 is trying to slice a static array, which is not a range. ok, thanks. I lost track of the double meaning of static ... I normally think

basic interactive readf from stdin

2015-12-26 Thread Jay Norwood via Digitalmars-d-learn
Simple VS console app in D. Reading lines to a string variable interactively. Object is to have no extra blank lines in the console output. Seems very broken for this use, requiring two extra "enter" entries before the outputs both appear. Version DMD32 D Compiler v2.069.2 import std.stdio;

Re: basic interactive readf from stdin

2015-12-26 Thread Jay Norwood via Digitalmars-d-learn
On Saturday, 26 December 2015 at 19:52:15 UTC, Adam D. Ruppe wrote: On Saturday, 26 December 2015 at 19:40:59 UTC, Jay Norwood wrote: Simple VS console app in D. If you are running inside visual studio, you need to be aware that output will be block buffered, not line buffered, because VS

Re: basic interactive readf from stdin

2015-12-26 Thread Jay Norwood via Digitalmars-d-learn
On Saturday, 26 December 2015 at 20:38:52 UTC, tcak wrote: On Saturday, 26 December 2015 at 20:19:08 UTC, Adam D. Ruppe wrote: On Saturday, 26 December 2015 at 20:11:27 UTC, karthikeyan wrote: I experience the same as the OP on Linux Mint 15 with dmd2.069 and 64 bit machine. I have to press en

Re: basic interactive readf from stdin

2015-12-26 Thread Jay Norwood via Digitalmars-d-learn
On Saturday, 26 December 2015 at 20:19:08 UTC, Adam D. Ruppe wrote: On Saturday, 26 December 2015 at 20:11:27 UTC, karthikeyan wrote: I experience the same as the OP on Linux Mint 15 with dmd2.069 and 64 bit machine. I have to press enter twice to get the output. I read http://ddili.org/ders/d

Re: basic interactive readf from stdin

2015-12-26 Thread Jay Norwood via Digitalmars-d-learn
On Sunday, 27 December 2015 at 00:20:51 UTC, Ali Çehreli wrote: On 12/26/2015 12:11 PM, karthikeyan wrote: > I read http://ddili.org/ders/d.en/input.html and inserted a space before %s > but still no use. Am I missing something here with the latest version? The answer is nine chapters later. :)

Re: How to instantiate a map with multiple functions

2015-12-26 Thread Jay Norwood via Digitalmars-d-learn
I'm playing around with something also trying to apply multiple functions. In my case, a sample is some related group of measurements taken simultaneously, and I'm calculating a group of metrics from the measured data of each sample. This produces the correct results for the input data, and it

  1   2   >