On 07/26/2016 12:53 PM, Adam D. Ruppe via Digitalmars-d-learn wrote:
On Tuesday, 26 July 2016 at 19:30:35 UTC, Charles Hixson wrote:
It looks as if the entire file is stored in memory, which is not at
all what I want, but I also can't really believe that's what's going on.
It is just mapped t
On Tuesday, 26 July 2016 at 22:23:37 UTC, Jerry wrote:
On Tuesday, 26 July 2016 at 19:02:32 UTC, Gorge Jingale wrote:
I might want to actually use Add internally in B so I can add
some elements behind the scenes, I do not want to expose it to
the outside world though.
There are no way to remo
On Tuesday, 26 July 2016 at 15:11:00 UTC, llaine wrote:
Hi guys,
I'm using D since a few month now and I was wondering why
people don't jump onto it that much and why it isn't the "big
thing" already.
Everybody is into javascript nowadays, but IMO even for doing
web I found Vibe.d more inte
On Tuesday, 26 July 2016 at 16:35:26 UTC, Charles Hixson wrote:
That's sort of what I have in mind, but I want to do what in
Fortran would be (would have been?) called record I/O, except
that I want a file header that specifies a few things like
magic number, records allocated, head of free lis
On Tuesday, 26 July 2016 at 15:11:00 UTC, llaine wrote:
I'm using D since a few month now and I was wondering why
people don't jump onto it that much and why it isn't the "big
thing" already.
D2 is under active development. Bugs get fixed, bottlenecks get
optimized, and features get added or
On Tuesday, 26 July 2016 at 19:02:32 UTC, Gorge Jingale wrote:
I might want to actually use Add internally in B so I can add
some elements behind the scenes, I do not want to expose it to
the outside world though.
There are no way to remove things from an template directly. But
you could howe
On 7/26/16 4:58 PM, ParticlePeter wrote:
On Tuesday, 26 July 2016 at 20:18:48 UTC, Steven Schveighoffer wrote:
void processMember( T, ignore... )() {
foreach( member; __traits( allMembers, T )) { // this is a
compile-time list, so it's a static foreach.
foreach(i, arg; ignore ){ // i
On Tuesday, 26 July 2016 at 21:20:18 UTC, ParticlePeter wrote:
...
First of all there seems to be a typo, it should not be:
else static if(i + 1 == arg.length)
ignore must be used instead of arg, as arg.length is the length
of a string:
else static if(i + 1 == ignore.length)
if ignore is
On Tuesday, 26 July 2016 at 21:01:19 UTC, Ali Çehreli wrote:
On 07/26/2016 01:58 PM, ParticlePeter wrote:
On Tuesday, 26 July 2016 at 20:18:48 UTC, Steven Schveighoffer
wrote:
...
void processMember( T, ignore... )() {
foreach( member; __traits( allMembers, T )) { // this is a
compile-time l
On Tuesday, 26 July 2016 at 15:11:00 UTC, llaine wrote:
Hi guys,
I'm using D since a few month now and I was wondering why
people don't jump onto it that much and why it isn't the "big
thing" already.
Everybody is into javascript nowadays, but IMO even for doing
web I found Vibe.d more inte
On 07/26/2016 01:58 PM, ParticlePeter wrote:
On Tuesday, 26 July 2016 at 20:18:48 UTC, Steven Schveighoffer wrote:
...
void processMember( T, ignore... )() {
foreach( member; __traits( allMembers, T )) { // this is a
compile-time list, so it's a static foreach.
foreach(i, arg; ignore ){ //
On Tuesday, 26 July 2016 at 20:18:48 UTC, Steven Schveighoffer
wrote:
...
void processMember( T, ignore... )() {
foreach( member; __traits( allMembers, T )) { // this is a
compile-time list, so it's a static foreach.
foreach(i, arg; ignore ){ // i is the index into the ignore
tuple
On Tuesday, 26 July 2016 at 20:18:48 UTC, Steven Schveighoffer
wrote:
...
Thanks a lot for this really cool and detailed explanation
(upvoting!).
It's a bit weird to work on these compile-time things, but they
are so cool when you look at what is available in std.meta and
std.traits :)
Agr
On Tuesday, 26 July 2016 at 19:08:09 UTC, H. S. Teoh wrote:
On Tue, Jul 26, 2016 at 06:39:58PM +, Gorge Jingale via
Digitalmars-d-learn wrote:
On Tuesday, 26 July 2016 at 17:38:43 UTC, Suliman wrote:
> I have arbitrary polygon. I need any solution. Performance
> is does not matter at curren
On 7/26/16 3:30 PM, ParticlePeter wrote:
I want to generate one function for any struct data member, but also
want to be able to skip few of the members. The first part works, but I
have some trouble with the skipping.
I pass the struct type and a Compile-time Argument List of strings as
templat
On 7/26/16 3:30 PM, Charles Hixson via Digitalmars-d-learn wrote:
On 07/26/2016 11:31 AM, Steven Schveighoffer via Digitalmars-d-learn wrote:
Now, C i/o's buffering may not suit your exact needs. So I don't know
how it will perform. You may want to consider mmap which tells the
kernel to link
On Tuesday, 26 July 2016 at 19:30:35 UTC, Charles Hixson wrote:
It looks as if the entire file is stored in memory, which is
not at all what I want, but I also can't really believe that's
what's going on.
It is just mapped to virtual memory without actually being loaded
into physical memory,
On Tuesday, 26 July 2016 at 19:30:18 UTC, ParticlePeter wrote:
// Second approach, get warnings for every skipped member
// and every line after the return statement:
// Warning: statement is not reachable
void processMember( T, ignore... )() {
foreach( member; __traits( allMembers, T )) {
I want to generate one function for any struct data member, but
also want to be able to skip few of the members. The first part
works, but I have some trouble with the skipping.
I pass the struct type and a Compile-time Argument List of
strings as template arguments to a template function, lis
On 07/26/2016 11:31 AM, Steven Schveighoffer via Digitalmars-d-learn wrote:
On 7/26/16 1:57 PM, Charles Hixson via Digitalmars-d-learn wrote:
Thanks. Since there isn't any excess overhead I guess I'll use stdio.
Buffering, however, isn't going to help at all since I'm doing
randomIO. I know t
On Tue, Jul 26, 2016 at 06:39:58PM +, Gorge Jingale via Digitalmars-d-learn
wrote:
> On Tuesday, 26 July 2016 at 17:38:43 UTC, Suliman wrote:
> > I have arbitrary polygon. I need any solution. Performance is does not
> > matter at current moment.
>
> A polygon is made up of lines. For a point
I might want to actually use Add internally in B so I can add
some elements behind the scenes, I do not want to expose it to
the outside world though.
Is there a way to remove functions and fields that a mixin
template adds?
I use mixin templates to create other types contents, like
struct A { mixin Stuff(); }
But Sometimes I only want some of the stuff.
struct B { mixin Stuff(); @disable Add(); }
B is like an A but doesn't have the abilit
On Tuesday, 26 July 2016 at 17:38:43 UTC, Suliman wrote:
I have arbitrary polygon. I need any solution. Performance is
does not matter at current moment.
A polygon is made up of lines. For a point to be inside a convex
polygon, it must be to the "right" of all the lines with
clockwise orienta
On 7/26/16 1:57 PM, Charles Hixson via Digitalmars-d-learn wrote:
Thanks. Since there isn't any excess overhead I guess I'll use stdio.
Buffering, however, isn't going to help at all since I'm doing
randomIO. I know that most of the data the system reads from disk is
going to end up getting th
On Tue, Jul 26, 2016 at 05:38:43PM +, Suliman via Digitalmars-d-learn wrote:
> I have arbitrary polygon. I need any solution. Performance is does not
> matter at current moment.
In that case, maybe you'd want to look at:
https://en.wikipedia.org/wiki/Vatti_clipping_algorithm
Note, ho
On 07/26/2016 10:18 AM, Steven Schveighoffer via Digitalmars-d-learn wrote:
On 7/26/16 12:58 PM, Charles Hixson via Digitalmars-d-learn wrote:
Ranges aren't free, are they? If so then I should probably use stdfile,
because that is probably less likely to change than core.stdc.stdio.
Do you
I have arbitrary polygon. I need any solution. Performance is
does not matter at current moment.
On 7/26/16 12:58 PM, Charles Hixson via Digitalmars-d-learn wrote:
Ranges aren't free, are they? If so then I should probably use stdfile,
because that is probably less likely to change than core.stdc.stdio.
Do you mean slices?
When I see "f.rawRead(&item[0 .. 1])" it looks to me as if unnee
On 07/26/2016 06:41 AM, Richard wrote:
From http://wiki.dlang.org/Operator_precedence
In case it's useful to others, I explain that table a little bit here
(associativity, unordered operators, and the precedence of =>):
http://ddili.org/ders/d.en/operator_precedence.html
Ali
On 07/26/2016 05:31 AM, Steven Schveighoffer via Digitalmars-d-learn wrote:
On 7/25/16 9:19 PM, Charles Hixson via Digitalmars-d-learn wrote:
On 07/25/2016 05:18 PM, ketmar via Digitalmars-d-learn wrote:
On Monday, 25 July 2016 at 18:54:27 UTC, Charles Hixson wrote:
Are there reasons why one w
On Tue, Jul 26, 2016 at 01:32:00PM +, Suliman via Digitalmars-d-learn wrote:
> Ideally I need algorithm that can return bool if one polygon
> overlapped/intersected by another. But I do not know math.
Are you talking about triangles, or general polygons? Are the polygons
convex or arbitrary?
On 07/25/2016 09:22 PM, ketmar via Digitalmars-d-learn wrote:
On Tuesday, 26 July 2016 at 04:05:22 UTC, Charles Hixson wrote:
Yes, but I really despise the syntax they came up with. It's
probably good if most of your I/O is ranges, but mine hasn't yet ever
been. (Combining ranges with random
Hi guys,
I'm using D since a few month now and I was wondering why people
don't jump onto it that much and why it isn't the "big thing"
already.
Everybody is into javascript nowadays, but IMO even for doing web
I found Vibe.d more interesting and efficient than node.js for
example.
I agre
On Tuesday, July 26, 2016 13:41:39 Richard via Digitalmars-d-learn wrote:
> On Tuesday, 26 July 2016 at 13:19:54 UTC, ag0aep6g wrote:
> > Operator precedence is different from what you think. `a ? b :
> > c = d` means `(a ? b : c) = d`. But you want `a ? b : (c = d)`.
> > So you need parentheses ar
On Tuesday, 26 July 2016 at 13:19:54 UTC, ag0aep6g wrote:
Operator precedence is different from what you think. `a ? b :
c = d` means `(a ? b : c) = d`. But you want `a ? b : (c = d)`.
So you need parentheses around `p+=1`.
Or just go with `if` and `else`. It's clearer anyway.
From http://wi
Ideally I need algorithm that can return bool if one polygon
overlapped/intersected by another. But I do not know math.
After some googling I found topic on SO[1] about point
inside/outside polygon. It's not directly what I need, but as
temporal solution would be enough.
Maybe somebody alrea
On 07/26/2016 03:09 PM, Richard wrote:
if(n%p==0)
n/=p;
else
p+=1;
[...]
However, if I replace the content of the for loop with the ?: operator,
the program is not
correct anymore (largestPrimeFactor(4) now returns 3):
[...]
n%p==0 ? n/=p : p+=1
On Tuesday, 26 July 2016 at 13:17:27 UTC, Adam D. Ruppe wrote:
(n%p==0) ? n/=p : p+=1 ;
And actually, using ?: with /= and += is kinda bizarre.
I think you are better off leaving this as if/else since the
point of this is the assignment rather than the return value.
On Tuesday, 26 July 2016 at 13:09:28 UTC, Richard wrote:
n%p==0 ? n/=p : p+=1 ;
Try
(n%p==0) ? n/=p : p+=1 ;
I'm pretty sure the order of operations (precedence rules) puts
?: above ==.
On Tuesday, 26 July 2016 at 13:09:28 UTC, Richard wrote:
Hello all,
try using some parentheses:
(n%p==0) ? (n/=p) : (p+=1) ;
Hello all,
I've got a program that correctly computes the largest factor in
the prime decomposition of a positive number:
*
import std.math std.stdio;
ulong largestPrimeFactor(ulong n) {
for(ulong p=2; p<=sqrt(cast(real)n); ) {
i
On Tuesday, 26 July 2016 at 10:35:12 UTC, Etranger wrote:
I'll have time 2 months from now as I'm getting married in 2
weeks :)
Congratulations!
On 7/25/16 9:19 PM, Charles Hixson via Digitalmars-d-learn wrote:
On 07/25/2016 05:18 PM, ketmar via Digitalmars-d-learn wrote:
On Monday, 25 July 2016 at 18:54:27 UTC, Charles Hixson wrote:
Are there reasons why one would use rawRead and rawWrite rather than
fread and fwrite when doiing binary
On Tuesday, 26 July 2016 at 12:13:02 UTC, DLearner wrote:
What is the recommended way of identifying which assert has
been triggered?
If you compile with -g, run the program in a debugger. It will
tell you.
If you compile and do NOT use -release, the error message
automatically printed by t
On 7/26/16 8:13 AM, DLearner wrote:
Suppose a program contains several points that control should not get to.
So each such point is blocked by assert(0).
What is the recommended way of identifying which assert has been triggered?
Is one allowed anything like 'assert(0,"Crashed at point A");', wh
Suppose a program contains several points that control should not
get to.
So each such point is blocked by assert(0).
What is the recommended way of identifying which assert has been
triggered?
Is one allowed anything like 'assert(0,"Crashed at point A");',
where the message goes to stderr?
On Saturday, 23 July 2016 at 23:55:44 UTC, ag0aep6g wrote:
On 07/23/2016 01:05 PM, Etranger wrote:
[...]
To avoid the string mixin, you can let VecExpression take an
alias of the mixin template (Vec_impl/VecSum_impl) and the list
of arguments:
[...]
Thanks ! that's way much cleaner and t
On Sunday, 24 July 2016 at 10:53:41 UTC, Ilya Yaroshenko wrote:
On Saturday, 23 July 2016 at 11:05:57 UTC, Etranger wrote:
[...]
Yes, but it is more complicated in terms of multidimensional
and generic abstraction.
First we need to finish and test general matrix multiplication
[2].
[...]
On Tuesday, 26 July 2016 at 00:54:59 UTC, Michael Coulombe wrote:
If that's ok, then try out std.traits.Select or
std.traits.select:
https://dlang.org/phobos/std_traits.html#Select
Damn, I looked real hard for that template, I knew it existed. I
expected it to be in std.meta though.
On 07/26/2016 11:42 AM, drug wrote:
> Another option is `makeIndex` (std.algorithm.sorting) and then sorting
> of that index.
That's an interesting option; at least I don't have to touch the range.
Thanks.
--
Bahman
On 07/26/2016 10:41 AM, Jonathan M Davis via Digitalmars-d-learn wrote:
>> So it may be something about what kind of range I'm passing to `sort`.
>> Am I right?
>
> sort requires a random access range. Without knowing exactly which
> algorithms your using, I can't say for sure that that's the prob
26.07.2016 09:11, Jonathan M Davis via Digitalmars-d-learn пишет:
It's frequently the case that if you want to sort a range, you have to call
array() on it to convert it to an array, and then you can sort the array.
- Jonathan M Davis
Another option is `makeIndex` (std.algorithm.sorting) and t
53 matches
Mail list logo