I'm trying to add formatted output to my decimal arithmetic
module. Decimals should format like floating point, using 'E',
'F' and 'G', etc.
I would expect a format string like "%9.6e" to parse as width =
9, precision = 6, using exponential notation.
In std.format there is a FormatSpec struc
On Wednesday, 11 April 2012 at 19:33:58 UTC, Xan wrote:
Hi,
With helloworld program named with score or underscore, I
receive the following __annoying__ error:
$ gdmd-4.6 hola-temp.d
hola-temp.d: Error: module hola-temp has non-identifier
characters in filename, use module declaration instea
On Friday, 13 April 2012 at 01:10:40 UTC, Alex Rønne Petersen
wrote:
How do I pass a library search path to DMD on Windows?
I would love to know too!
Only place I found was to edit sc.ini sorry.
On 13-04-2012 03:10, Alex Rønne Petersen wrote:
How do I pass a library search path to DMD on Windows?
-L+ apparently...
--
- Alex
How do I pass a library search path to DMD on Windows?
--
- Alex
Joseph Rushton Wakeling:
> >> final size_t select(ref UniformRNG urng)
> >> {
> >> assert(_recordsRemaining > 0);
> >> assert(_sampleRemaining > 0);
> >
> > Probably it's better to move those asserts in preconditions/postconditions
> > or in
> > class/struct invariants.
>
> Those asserts are del
On 13/04/12 00:48, bearophile wrote:
final size_t select(ref UniformRNG urng)
{
assert(_recordsRemaining > 0);
assert(_sampleRemaining > 0);
Probably it's better to move those asserts in preconditions/postconditions or in
class/struct invariants.
Those asserts are deliberately intended for th
On 12/04/12 23:34, Dmitry Olshansky wrote:
Aye, and in general community does appreciate any enhancements via pull requests
on github:
https://github.com/D-Programming-Language
OK, I'll see what I can do. I'd like to discuss and refine the design a bit
further before making any pull request -
Joseph Rushton Wakeling:
Thanks ever so much for the extensive review.
They are shallow comments, mostly about syntax, etc. So writing
them requires little time.
Is this advised for all D modules, or just for stuff using the
C standard library?
I have said "there is also the syntax" ins
On 12/04/12 21:54, bearophile wrote:
sampling_test_simple!(VitterA!Random,Random)(100,5,urng);
Currently your code doesn't work if you want to use a Xorshift generator.
Ahhh, I see what you mean now -- the sampler classes are fine, but the way the
main() function is written means you ca
On 12/04/12 21:54, bearophile wrote:
Some comments on the details of your code:
Thanks ever so much for the extensive review.
import std.c.time;
In D there there is also the syntax:
import std.c.time: foo, bar, baz;
That tells the person that reads the code what names are used.
Is this
On Thursday, 12 April 2012 at 05:18:22 UTC, Andrej Mitrovic wrote:
On 4/12/12, vmars316 wrote:
What is looking for? *import* something?
Remove the space between '-I' and the import path.
Ah, Thank you very much, works perfectly.
Ok, so that's Dmd with Dfl.
The myForm.exe is 743K large.
T
On 12.04.2012 20:59, Joseph Rushton Wakeling wrote:
On 12/04/12 16:45, Joseph Rushton Wakeling wrote:
What I thought I'd do is implement some clever algorithms for random
sampling
which I've already done in a C based on the GNU Scientific Library.
I noticed that there is already a randomSample
On 04/12/2012 01:27 PM, Joseph Rushton Wakeling wrote:
> What I _still_ don't understand is the statement in the constructor:
>
> // we should skip some elements initially so we don't always
> // start with the first
>
> ... as it seems to me that doing so would bugger up the selection
> algorith
On Thursday, 12 April 2012 at 16:59:31 UTC, Joseph Rushton
Wakeling wrote:
On 12/04/12 16:45, Joseph Rushton Wakeling wrote:
What I thought I'd do is implement some clever algorithms for
random sampling
which I've already done in a C based on the GNU Scientific
Library.
I noticed that there i
On 12/04/12 20:39, Ali Çehreli wrote:
That's misleading. RandomSample is a lazy range. The output seems to be elements
of an array only as you pull data out of this range.
Ahhh, it's lazy evaluation. That would explain why you can set ret.gen = gen in
the randomSample functions and have it wo
Joseph Rushton Wakeling:
> https://github.com/WebDrake/SampleD
Some comments on the details of your code:
> import std.c.time;
In D there there is also the syntax:
> import std.c.time: foo, bar, baz;
That tells the person that reads the code what names are used.
--
> inte
Manfred Nowak:
> On the contrary: it requires work to implement limitations. Therefore
> limitations are implemented only to shield users from mess.
Also, removing limitations from a language is usually FAR simpler than
introducing them later :-)
Bye,
bearophile
On 04/12/2012 11:30 AM, Joseph Rushton Wakeling wrote:
> What gets output at the end is clearly an array containing a subset of
> the original input.
That's misleading. RandomSample is a lazy range. The output seems to be
elements of an array only as you pull data out of this range.
> The con
Hello all,
I'm trying to understand the internal operations of the RandomSample struct in
std.random.
What gets output at the end is clearly an array containing a subset of the
original input. But I can't understand how this is constructed.
The constructor sets various initial values and t
On Thursday, April 12, 2012 14:30:50 Xan wrote:
> But it's a messy limitation. Why we should have it? For C++
> compatibilities?
Messy? How so? You can't put any characters in a module name which aren't
valid identifiers. So what? Just name your module differently. Is your
complaint
that you ca
On Thu, Apr 12, 2012 at 07:00:35PM +0200, DH wrote:
> Hi. I was wondering why the following works:
>
> filter!(a => a % 2 == 0)(map!(a => a + 1)([1,2,3,4,5]))
>
> but the following does not:
>
> [1,2,3,4,5]
> .map!(a => a + 1)()
> .filter!(a => a % 2 == 0)()
>
> ...givin
On Thursday, 12 April 2012 at 17:00:37 UTC, DH wrote:
Hi. I was wondering why the following works:
filter!(a => a % 2 == 0)(map!(a => a + 1)([1,2,3,4,5]))
but the following does not:
[1,2,3,4,5]
.map!(a => a + 1)()
.filter!(a => a % 2 == 0)()
...giving me the error `Er
Hi. I was wondering why the following works:
filter!(a => a % 2 == 0)(map!(a => a + 1)([1,2,3,4,5]))
but the following does not:
[1,2,3,4,5]
.map!(a => a + 1)()
.filter!(a => a % 2 == 0)()
...giving me the error `Error: no property 'filter' for type
'Result'`
The dot
On 12/04/12 16:45, Joseph Rushton Wakeling wrote:
What I thought I'd do is implement some clever algorithms for random sampling
which I've already done in a C based on the GNU Scientific Library.
I noticed that there is already a randomSample class in std.random, which by the
look of it is usi
On 12/04/12 18:26, James Miller wrote:
There is support for fully all 4 types of intervals using
std.random.uniform. You just specify the type of interval using a
template parameter.
The default is this: uniform!("[)")(a,b);
And you want this: uniform!("[]")(a,b);
You can also do "()" and "(]
* Joseph Rushton Wakeling [2012-04-12 16:45:34
+0200]:
> (3) Uniform random number on (0,1)
>
> The algorithms' specification explicitly refers to uniform random
> numbers on the open interval, which I take to mean (0,1) i.e.
> excluding zero. Phobos currently provides only a half-open uni
Hi Dmitry,
Thanks for your thoughts and for pointing me at some aspects of D I'd not come
across before.
I think that if you like function pointer thing, you'd love D's delegates and
lambdas. If templates are too pervasive it might be better just use little bit
of dynamic stuff.
I was not t
> Could it be my compiler version? Here's what I have:
>
> $ dmd
> DMD32 D Compiler v2.055
Yeah, I think those templates were added in the last release or two. The
current version is 2.058 (and 2.059 is in beta).
On Thursday, 12 April 2012 at 15:36:25 UTC, Justin Whear wrote:
On Thu, 12 Apr 2012 16:11:11 +0200, dcoder wrote:
My question is, how do I change the code above so that it
works even if I change the name of the file/module? I'm
looking for
clean solution something like a macro if one actuall
On 12.04.2012 18:45, Joseph Rushton Wakeling wrote:
Hello all,
Hello there,
[snip]
So, introduction away, here are the main questions I came up with in
creating the code.
(1) Effective handling of random numbers.
The design concept was for the sampler classes to use a specified
unifor
On Thu, 12 Apr 2012 16:11:11 +0200, dcoder wrote:
> My question is, how do I change the code above so that it
> works even if I change the name of the file/module? I'm looking for
> clean solution something like a macro if one actually exists.
Check out packageName, moduleName, and fullyQualifie
On Thu, 12 Apr 2012 10:49:03 -0400, James Miller wrote:
Glad you got help Xan, but for future reference can you please keep
questions to D.learn? It is somewhat frustrating to see the question
"How do I do that?" on this list, since it is for discussion, and
high-level questions, not for people
* James Miller [2012-04-13 02:49:03 +1200]:
> Glad you got help Xan, but for future reference can you please keep
> questions to D.learn? It is somewhat frustrating to see the question
> "How do I do that?" on this list, since it is for discussion, and
> high-level questions, not for people that
* Xan [2012-04-11 20:28:38 +0200]:
> On Wednesday, 11 April 2012 at 13:04:01 UTC, Steven Schveighoffer
> wrote:
> >On Wed, 11 Apr 2012 08:53:00 -0400, Xan
> >wrote:
> >
[snip]
> >writeln(g(&f)(1));
> >
> >Unlike C, you *must* take the address of a function symbol to get
> >a function pointer.
>
Hello all,
My programming experience is mostly in C with some C++, so much of the
programming style of D is not familiar to me. With that in mind, I thought I'd
set up a little pet project to try and learn good D programming style.
What I thought I'd do is implement some clever algorithms fo
works and GetLastError() returns 0 in both cases.
Op 12 april 2012 16:13 schreef Kagamin het volgende:
> #include
> void main()
> {
> LPTHREAD_START_ROUTINE LoadLibAddy = (LPTHREAD_START_ROUTINE)**
> GetProcAddress(**GetModuleHandle("kernel32.dll"**), "LoadLibraryA");
> CreateThread(NULL,0,**
#include
void main()
{
LPTHREAD_START_ROUTINE LoadLibAddy =
(LPTHREAD_START_ROUTINE)GetProcAddress(GetModuleHandle("kernel32.dll"),
"LoadLibraryA");
CreateThread(NULL,0,LoadLibAddy,"mydll.dll",0,NULL);
}
?
Hello.
I am reading through TDPL by Andresscu. The book has the
following example, which I am abbreviating:
void main( string[] args) {
Stat [] stats;
foreach( arg; args[1..$]) {
auto newStat = cast(Stat) Object.factory( "statsinc04." ~
arg);
enforce( newStat, "Invalid statist
On Thu, 12 Apr 2012 08:30:50 -0400, Xan wrote:
On Wednesday, 11 April 2012 at 19:50:18 UTC, Steven Schveighoffer wrote:
Now, you *can* possibly name the module differently using a module
statement, but this is highly discouraged. If you do this, the only
way another module can import your
Xan wrote:
> But it's a messy limitation.
On the contrary: it requires work to implement limitations. Therefore
limitations are implemented only to shield users from mess.
Not having descovered any benefit of a limitation might point to
insufficient empirical knowledge.
-manfred
Jonathan M Davis , dans le message (digitalmars.D.learn:34332), a
écrit :
> On Sunday, April 08, 2012 01:24:02 Caligo wrote:
>> On Sat, Apr 7, 2012 at 11:01 PM, Jonathan M Davis
> wrote:
>> > What do you mean my static associative arrays? Are you asking why you
>> > can't
>> > initialize a stati
On Wednesday, 11 April 2012 at 19:50:18 UTC, Steven Schveighoffer
wrote:
On Wed, 11 Apr 2012 15:33:56 -0400, Xan
wrote:
Hi,
With helloworld program named with score or underscore, I
receive the following __annoying__ error:
$ gdmd-4.6 hola-temp.d
hola-temp.d: Error: module hola-temp has n
I tried again with a few other random C dll's stolen around my system and
they all work perfectly. it's only the D dll that gives me trouble.
On Wednesday, 11 April 2012 at 15:25:56 UTC, Stefan wrote:
On Wednesday, 11 April 2012 at 13:00:45 UTC, Andrea Fontana
wrote:
On Wednesday, 11 April 2012 at 12:46:30 UTC, Andrea Fontana
wrote:
How can I redirect stdout / stderr to file (from D not shell)?
Self-reply:
It works using std.c way
45 matches
Mail list logo