Re: Linking OpenSSL on Windows

2012-09-26 Thread Jason Spencer
I think this thread is not TOO old to use as a place to beg for help :) I've wandered into this nightmare, and I'm hoping someone who's been down this road can point the way back to the light. Summary: "no OPENSSL_Applink" runtime error when executing D openssl application. I have managed

Re: FormattedRead hex string

2012-09-24 Thread Jason Spencer
On Monday, 24 September 2012 at 16:32:45 UTC, monarch_dodra wrote: On Monday, 24 September 2012 at 15:05:54 UTC, Jason Spencer wrote: I imagine there's a slick way to do this, but I'm not seeing it. I have a string of hex digits which I'd like to convert to an ar

FormattedRead hex string

2012-09-24 Thread Jason Spencer
I imagine there's a slick way to do this, but I'm not seeing it. I have a string of hex digits which I'd like to convert to an array of 8 ubytes: 0123456789abcdef --> [0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF] I'm looking at std.format.formattedRead, but the documentation is...lighti

Re: easier way?

2010-08-25 Thread Jason Spencer
== Quote from bearophile (bearophileh...@lycos.com)'s article > I suggest you to create a templated struct where the template arguments are the element type and the number of dimensions. Do you mean just the number of dimensions, or do you mean the size along each dimension? Knowing just the # of

Re: easier way?

2010-08-25 Thread Jason Spencer
== Quote from bearophile (bearophileh...@lycos.com)'s article > Jason Spencer: > > Is there a better way to lay this out? > Is this good enough for you? It's certainly better. I'll have to look at how this plays with some of my other usage, where dimensions come into p

easier way?

2010-08-25 Thread Jason Spencer
I have the following sample program: --- import std.algorithm, std.stdio; real mean(T: Elem[], Elem)(T data) { return reduce!("a + b")(0.0, data) / data.length; } real mean(T: Elem[][], Elem)(T data) { real partSum = 0; int count = 0; foreach (row; data) { partSum += reduce!

Re: A confusing expression?

2010-08-02 Thread Jason Spencer
I'm just trying to figure out what the error would be, exactly. That a programmer, knowing the language specification, obeyed it and wrote an expression using the shortest syntax? Rhetoric aside, the result is not unambiguous, it just requires that the reader understand precedence. That's an arg

Re: Casting an expression to bool means testing for 0 or !=0 for arithmetic types

2010-08-01 Thread Jason Spencer
== Quote from Jonathan M Davis (jmdavisp...@gmail.com)'s article > For logic errors, efficiency isn't really an issue, since they > shouldn't be happening. If they are, go fix your code and it won't > be an issue. That gets less true as the cost of a try block goes up. Even if logic errors never

Re: Casting an expression to bool means testing for 0 or !=0 for arithmetic types

2010-07-31 Thread Jason Spencer
== Quote from Dmitry Olshansky (dmitry.o...@gmail.com)'s article > Honestly, I'd suggest using exceptions instead of error codes. This seems to be an increasingly common but still expensive suggestion for error handling. Unless D has made great strides in exception performance (which is entirely

Re: string initialization question.

2010-07-31 Thread Jason Spencer
== Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article > I was wrong, I looked through the runtime and did not find such a function. std.string has a repeat() function. Try: import std.string; void main() { string divider = repeat("-", 5); writeln(divider); } Jason

Re: alias = compile-time variants?

2010-07-31 Thread Jason Spencer
== Quote from Philippe Sigaud (philippe.sig...@gmail.com)'s article > --0016e6d58a039d35e2048c9aa7e2 > > I thought they could only be symbols. That is, an alias is a 'link', a sort > of pointer to a symbol: a template name, a module name, a function > name, etc. Whatever confidence you inspired by

Re: various questions

2010-07-31 Thread Jason Spencer
@bearophile: Got it. Had it mostly worked out before reading, but this helps clarify the static foreach part. Thanks, gang! Jason

Re: various questions

2010-07-31 Thread Jason Spencer
== Quote from Rory Mcguire (rjmcgu...@gm_no_ail.com)'s article > Jason Spencer wrote: > > == Quote from Rory Mcguire (rjmcgu...@gm_no_ail.com)'s article > >> Jason Spencer wrote: > > > >> > I nievely went and replaced "foreach (t; Iota!(str_types.

Re: various questions

2010-07-30 Thread Jason Spencer
== Quote from Rory Mcguire (rjmcgu...@gm_no_ail.com)'s article > Jason Spencer wrote: > > I nievely went and replaced "foreach (t; Iota!(str_types.length))" > > with "foreach (t; str_types.length)", since the length of that > > array is known at c

Re: various questions

2010-07-29 Thread Jason Spencer
Ok, I've gone over this, adapted it, and mostly understand it. I just have one question left: == Quote from bearophile (bearophileh...@lycos.com)'s article > template Iota(int stop) { > ... > alias TypeTuple!(Iota!(stop-1), stop-1) Iota; > } > ... > foreach (t; Iota!(str_types.length)

alias = compile-time variants?

2010-07-29 Thread Jason Spencer
In writing templates that make heavy use of alias parameters, does anyone else feel uneasy about whether the caller will pass a type, a value, or a schmoo? I'm having a hard time getting my head around how wide-open aliases are and trying to resist the urge to put in thousands of static asserts to

Re: various questions

2010-07-28 Thread Jason Spencer
That's COOL! I'll have to look at these closer, but I definitely get what you're doing. Thanks a million. == Quote from bearophile (bearophileh...@lycos.com)'s article > Simpler: > import std.stdio: writeln; > import std.typetuple: TypeTuple; > template Iota(int stop) { > static if (stop <=

Re: various questions

2010-07-28 Thread Jason Spencer
== Quote from bearophile (bearophileh...@lycos.com)'s article Thanks for all the suggestions! A little more discussion: > > So I need some slick way of mapping the run-time element size, row count, > > and column count into a static array type to instantiate my template with. > A basic brutal wa

Re: various questions

2010-07-28 Thread Jason Spencer
Forgot a couple of things: - this is all using D2.047. - Another question (in reference to part 2 before): I'd like to support about 4 base types and 5 or 6 different matrix sizes. So that's roughly 20 type combinations for my template. But I decide these based on command-line arguments at run

various questions

2010-07-28 Thread Jason Spencer
I'm working on a program to do statistics on matrices of different sizes, and I've run into a handful of situations where I just can't seem to find the trick I need. In general, I'm trying to make my functions work on static arrays of the proper size, and template that up for the different sizes I