On Monday, 9 April 2018 at 08:27:50 UTC, Per Nordlöw wrote:
Is it possible to get the source expression sent to a lazy
function?
So that I can implement something like
show(Arg)(lazy Arg arg)
{
writeln(arg.sourceof, arg);
}
used as
show(1+2+3);
will print
1+2+3:6
Because of t
On Sunday, 18 March 2018 at 12:59:06 UTC, tipdbmp wrote:
I can't read assembly but it seems to me that it doesn't:
https://godbolt.org/g/PCsnPT
I think C++'s sort can take a "function object" that can get
inlined.
Correct it does not get in-lined.
Even with -O3 it does not.
The reason is that
On Thursday, 15 March 2018 at 15:28:16 UTC, Miguel L wrote:
Why does std.math.signbit only work for floating point types?
Is there an analogue function for integer types? what is the
best way to compare the sign of a float with the sign of an
integer?
Thanks in advance
integers don't have a
On Sunday, 11 March 2018 at 23:12:30 UTC, Joe wrote:
I'm getting a compiler error in a qsort() call as follows:
qsort(recs, num_recs, (Record *).sizeof, compar);
Record is a struct, recs is a fixed array of pointers to
Record's and num_recs is a size_t that holds the number of
valid recor
On Saturday, 10 March 2018 at 20:48:06 UTC, Nordlöw wrote:
If I have a function
bool f(Rs...)(Rs rs)
is it somehow possible to map and forward all its arguments
`rs` to another function
bool g(Rs...)(Rs rs);
through a call to some map-and-forward-like-function
`forwardMap` in somet
On Monday, 5 March 2018 at 18:04:20 UTC, Nordlöw wrote:
On Monday, 5 March 2018 at 16:07:49 UTC, Steven Schveighoffer
wrote:
No, I mean you call holeKey at *runtime*. Inlined, it's just
returning a constant, so it should reduce to a constant.
A compile-time constant visible to the optimizer?
On Tuesday, 27 February 2018 at 16:17:20 UTC, Jonathan wrote:
I know Python's `with` statement can be used to have an
automatic close action:
```
with open("x.txt") as file:
#do something with file
#`file.close()` called automatically
```
I know D's `with` statement does somethi
On Monday, 26 February 2018 at 18:01:07 UTC, Marc wrote:
I've tried both gdb and windbg debugger both it either get a
"received signal ?" from gdb or crash the GUI application
(windbg).
The error is:
core.exception.OutOfMemoryError@src\core\exception.d(696):
Memory allocation failed
How do
On Thursday, 22 February 2018 at 13:21:04 UTC, joe wrote:
On Monday, 12 February 2018 at 08:47:58 UTC, RazvanN wrote:
[...]
Follow up question...
Why is *.parent always null?
e.g.:
extern(C++) class MyVisitor(AST): ParseTimeTransitiveVisitor!AST
{
override void visit(AST.Import i)
{
On Thursday, 15 February 2018 at 11:56:04 UTC, Andre Pany wrote:
Hi,
I just noticed that std.zip will throw an exception if the
source files exceeds 2 GB.
I am not sure whether this is a limitation of zip version 20 or
a bug. On wikipedia a
size limit of 4 GB is mentioned. Should I open an is
On Tuesday, 13 February 2018 at 14:10:44 UTC, number wrote:
Ok, thanks for the info. I guess I'll just use printf then for
larger enums.
To get the same convince you can use.
the enumToString from:
https://forum.dlang.org/post/pnggoabnnkojdonyz...@forum.dlang.org
and writeln the result oft th
On Tuesday, 13 February 2018 at 12:17:31 UTC, number wrote:
On Sunday, 11 February 2018 at 15:05:26 UTC, number wrote:
On Sunday, 11 February 2018 at 13:17:13 UTC, number wrote:
unable to fork: Cannot allocate memory
if i comment-out the line..
writeln(GdkKeysyms.GDK_Escape);
then it compiles
On Monday, 5 February 2018 at 19:54:09 UTC, Jiyan wrote:
Is there any work for an interactive interpreter for D -maybe
just for ctfe-able expressions?
It shouldnt be too hard to implement it regarding the fact,
that ctfe is kinda doing what
an interpreter should do i guess.
There is https://g
On Sunday, 4 February 2018 at 12:52:22 UTC, Ur@nuz wrote:
Getting compiler stack overflow when building my project, but
still do not know how to localize piece of code that triggers
this bug. Maybe this bug is already registered in bugzilla or
someone could give some advice where to dig into?
On Friday, 26 January 2018 at 22:40:29 UTC, Timoses wrote:
Hey,
simple hello world crashes with segfault:
[...]
I can not reproduce this.
On Saturday, 27 January 2018 at 19:43:50 UTC, Stefan Koch wrote:
On Saturday, 27 January 2018 at 19:42:01 UTC, Matt wrote:
Godbolt link: https://godbolt.org/g/t5S976
The actual code is :
imul edi, edi
mov eax, edi
ret
The rest is runtime initialization.
which you can remove using an undocu
On Saturday, 27 January 2018 at 19:42:01 UTC, Matt wrote:
Godbolt link: https://godbolt.org/g/t5S976
The actual code is :
imul edi, edi
mov eax, edi
ret
The rest is runtime initialization.
which you can remove using an undocumented -betterC switch.
On Wednesday, 17 January 2018 at 13:36:26 UTC, Marc wrote:
I was looking for a library to use SQLite with D, found this
(https://code.dlang.org/packages/sqlite-d) but it has no
documentation or code example. I looked into files in the
source code and wrote this:
Database db = Database(name);
On Friday, 12 January 2018 at 14:13:22 UTC, Basile B. wrote:
I have a simple program that only compiles if the dependency is
not pre-compiled as a static library. It worked fine before.
Please test this
---
if [ ! -d "iz" ]; then
git clone https://www.github.com/BBasile/iz.git
fi
cd iz/sc
On Sunday, 7 January 2018 at 01:08:44 UTC, H. S. Teoh wrote:
On Sun, Jan 07, 2018 at 12:55:27AM +, Stefan Koch via
Digitalmars-d-learn wrote:
On Saturday, 6 January 2018 at 23:25:58 UTC, Ali Çehreli wrote:
> Is 'static foreach' sufficient for all needs or is there any
> v
On Saturday, 6 January 2018 at 23:25:58 UTC, Ali Çehreli wrote:
Is 'static foreach' sufficient for all needs or is there any
value for regular foreach over compile-time sequences?
Code unrelated to the question:
import std.stdio;
void main() {
// Old style compile-time foreach. This still
On Tuesday, 2 January 2018 at 10:27:11 UTC, Christian Köstlin
wrote:
Hi all,
over the holidays, I played around with processing some gzipped
json data. First version was implemented in ruby, but took too
long, so I tried, dlang. This was already faster, but not
really satisfactory fast. Then
On Wednesday, 20 December 2017 at 15:28:00 UTC, Christian Köstlin
wrote:
When working with json data files, that we're a little bigger
than
convenient I stumbled upon a strange behavior with joining of
mapresults
(I understand that this is more or less flatmap).
I mapped inputfiles, to JSONValu
On Saturday, 9 December 2017 at 18:45:18 UTC, Steven
Schveighoffer wrote:
I was thinking that all strings generated at compile-time have
a null-terminator added. But then I thought, wait, maybe that's
only specifically for string literals.
What is the true answer? If you generate a string, let
On Tuesday, 28 November 2017 at 13:39:11 UTC, Jayam wrote:
Is D language open source?
Do this have GUI Desktop application support ?
Do this have web api support ?
Can we compile our program to multi program ?
yes
yes some (dlang-ui for example)
yes some (vibe.d or arsd)
I don't know what you m
On Monday, 27 November 2017 at 14:08:27 UTC, Dmitry wrote:
I tried translate C++ programm to D, but result is different.
original:
https://github.com/urraka/alpha-bleeding/blob/master/src/alpha-bleeding.cpp
result (with removed alpha):
https://github.com/urraka/alpha-bleeding/blob/master/media/a
On Wednesday, 22 November 2017 at 15:23:58 UTC, Tim Hsu wrote:
I am afraid what will happen when casting this reference to
void *
a ref is a ptr.
The cast will produce a ptr which is valid as long as the ref is
valid.
On Wednesday, 22 November 2017 at 15:11:08 UTC, Tim Hsu wrote:
On Wednesday, 22 November 2017 at 15:07:54 UTC, Stefan Koch
&this will do.
I've tried it in the first place.
...
Error: this is not an lvalue
In that case casting to void* should be fine.
On Wednesday, 22 November 2017 at 15:07:08 UTC, Tim Hsu wrote:
I am a C++ game developer and I want to give it a try.
It seems "this" in Dlang is a reference instead of pointer.
How can I pass it as void *?
void foo(void *);
class Pizza {
public:
this() {
Pizza newone = this;
On Monday, 16 October 2017 at 23:56:00 UTC, Nicholas Wilson wrote:
using fullyQualifiedName [here]
(https://github.com/libmir/dcompute/blob/master/source/dcompute/driver/ocl/util.d#L120)
leads to a large compilation slowdown, but I only need it to
disambiguate up to the module level i.e. so that
On Wednesday, 20 September 2017 at 12:01:21 UTC, Nordlöw wrote:
When is
__traits(compiles, { ... } )
preferred over
is(typeof( { ... } ))
and vice versa when writing stuff like
enum isCopyable(S) = is(typeof( { S foo = S.init; S copy =
foo; } ));
?
Further, are there cases wh
On Friday, 15 September 2017 at 05:58:47 UTC, David Bennett wrote:
Hi Guys,
I've been playing around with CTFE today to see how far I would
push it but I'm having an issue appending to an array on a
struct in CTFE from a template:
[...]
are you using ucent ?
On Tuesday, 5 September 2017 at 09:44:09 UTC, Vino.B wrote:
Hi,
The below code is consume more memory and slower can you
provide your suggestion on how to over come these issues.
[...]
Much slower then ?
On Thursday, 31 August 2017 at 15:43:05 UTC, Per Nordlöw wrote:
Which allocator is best suited for allocating tree nodes (all
of equal size around 40-60 bytes in size) in one shot and then
delete them all in one go? My use case is parse trees.
Region Allocator.
On Thursday, 31 August 2017 at 14:44:07 UTC, vino wrote:
Hi All,
Can some provide me a example of how to remove all blank
lines from a file.
From,
Vino.B
ubyte[] fileData;
ubyte[] writeThis;
uint lastP;
fileData = readRaw(fileName);
foreach(uint p; ubyte b;fileData)
{
if (b == '\n')
On Wednesday, 30 August 2017 at 10:55:20 UTC, Timothy Foster
wrote:
On Wednesday, 30 August 2017 at 10:44:43 UTC, Ivan Kazmenko
wrote:
On Wednesday, 30 August 2017 at 10:13:57 UTC, Timothy Foster
wrote:
I'm not sure if this is a known issue, or if I just don't
understand how to use threads, but
On Wednesday, 23 August 2017 at 17:30:40 UTC, Drake44 wrote:
I'm on a Windows 7 machine and I'm using VisualD as my IDE. I'm
trying to work out what's chewing up all the RAM in a program
I'm writing... is there a tool that I can use that'll show me
what in my program keeps allocating memory?
On Monday, 14 August 2017 at 04:29:17 UTC, Johnson wrote:
```
auto valueToString(alias v)(){return v.stringof;}
enum a = valueToString!(0.75);
static assert(a == "0.75");
```
Thanks! You'd think that to would do this internally
automatically ;/
It only works on literals.
valueToString!(a) wil
On Monday, 7 August 2017 at 00:07:26 UTC, Johnson Jones wrote:
On Sunday, 6 August 2017 at 23:11:56 UTC, Nicholas Wilson wrote:
On Sunday, 6 August 2017 at 19:56:06 UTC, Johnson Jones wrote:
[...]
It is deliberately not possible. reproducible builds security
ect.
have a look at dubs preBuil
On Saturday, 5 August 2017 at 18:19:05 UTC, Stefan Koch wrote:
On Saturday, 5 August 2017 at 18:17:49 UTC, Simon Bürger wrote:
If a lambda function uses a local variable, that variable is
captured using a hidden this-pointer. But this capturing is
always by reference. Example:
int i = 1;
On Saturday, 5 August 2017 at 18:17:49 UTC, Simon Bürger wrote:
If a lambda function uses a local variable, that variable is
captured using a hidden this-pointer. But this capturing is
always by reference. Example:
int i = 1;
auto dg = (){ writefln("%s", i); };
i = 2;
dg(); //
On Saturday, 5 August 2017 at 15:33:57 UTC, Matthew Remmel wrote:
I feel like I'm missing something, but there has to be an
easier way to convert a value into an enum than switching over
every possible value: i.e
[...]
What you want is already in the standard library.
std.conv.to can convert
On Friday, 4 August 2017 at 13:09:55 UTC, Steven Schveighoffer
wrote:
Any foreach range statement like this:
foreach(var; A .. B)
is treated as if you wrote:
for(auto var = A; var < B; ++var)
So it's pretty much exactly like what you wrote, just the
initializer is different but the result
On Friday, 4 August 2017 at 12:49:30 UTC, Q. Schroll wrote:
One can do
BigInt n = returnsBigInt();
foreach (i; BigInt(0) .. n)
{ .. }
How is this implemented? The code for BigInt is very large and
I didn't find it.
And is it more efficient than
for (BigInt i = 0; i < n; ++i)
{ .. }
as
On Tuesday, 1 August 2017 at 16:16:46 UTC, 12345swordy wrote:
I don't see this anywhere in the documentation. I am asking
this as I want to know that it's possible to create a attribute
to prevent certain functions being called in the body of a
function. To enforce a certain code standard upon
On Monday, 31 July 2017 at 08:53:10 UTC, Cecil Ward wrote:
[ ... ]
I suspect that I am asking for something that literally makes
no sense at all. I wanted to try and avoid opening the door to
allowing the following kind of typing error now, eg
enum ip_address = 0x11223344;
[ ... ]
Please
On Thursday, 27 July 2017 at 14:30:33 UTC, Eugene Wissner wrote:
I have a multi-threaded application, whose threads normally run
forever. But I need to profile this program, so I compile the
code with -profile, send a SIGTERM and call exit(0) from my
signal handler to exit the program. The prob
On Tuesday, 18 July 2017 at 08:46:50 UTC, Jack Applegame wrote:
On Monday, 17 July 2017 at 17:38:23 UTC, Nordlöw wrote:
I'm want to define a specialization of `append()` that takes
only static arrays as inputs and returns a static array being
the sum of the lengths of the inputs.
Have anybody
On Tuesday, 18 July 2017 at 11:06:22 UTC, Enjoys Math wrote:
[ ... ]
The cast at the bottom gives a compiler error (can't cast
byte[] to double).
If you want to see how it's done check:
https://github.com/UplinkCoder/dmd/blob/newCTFE_on_master/src/ddmd/ctfe/bc.d
Though if you have the choice
On Tuesday, 18 July 2017 at 11:06:22 UTC, Enjoys Math wrote:
class OpCode
{
private:
byte[] bytes_;
public:
void opCall(Program program) const;
byte[] bytes() const {
return bytes_.dup;
}
}
class AddD : OpCode
{
private:
uint d, s;
pub
On Monday, 17 July 2017 at 18:38:16 UTC, Nordlöw wrote:
On Monday, 17 July 2017 at 17:46:42 UTC, ag0aep6g wrote:
int[n + m] result = a ~ b;
Further, the expression `a ~ b` here will allocate and create a
copy on the GC-heap before writing `result`.
Maybe LDC optimizes away this now or i
On Friday, 14 July 2017 at 23:02:24 UTC, Moritz Maxeiner wrote:
On Friday, 14 July 2017 at 21:20:29 UTC, Jonathan M Davis wrote:
Basically, the compiler _never_ looks at the bodies of other
functions when determining which attributes apply. It always
[...].
I'm well aware of that, but it doe
On Thursday, 13 July 2017 at 18:45:45 UTC, JN wrote:
I know that's a wrong syntax, I was just showing an example.
Yes, here it will work, but if you want to initialize only some
fields (poor man's keyword arguments), you can't use the
default constructor.
easily fixable by using FunctionLite
On Thursday, 13 July 2017 at 15:52:57 UTC, Dustmight wrote:
How do I read in input from the terminal without sitting there
waiting for it? I've got code I want to run while there's no
input, and then code I want to act on input when it comes in.
How do I do both these things?
You have to ask
On Sunday, 9 July 2017 at 04:03:09 UTC, H. S. Teoh wrote:
On Sat, Jul 08, 2017 at 03:09:09PM -0700, Ali Çehreli via
Digitalmars-d-learn wrote:
On 07/08/2017 02:29 PM, Andre Pany wrote:
> I use assert(false, tmp) to see the content of variable tmp
> as it seems there is no other way in CTFE.
On Monday, 3 July 2017 at 02:51:49 UTC, Filip Bystricky wrote:
Anyone?
The answer is no.
Partial deallocation in an arbitrary fashion is not advisable.
And there are no standard library mechanisms for it.
On Friday, 30 June 2017 at 23:53:19 UTC, bauss wrote:
I suspect the address is wrong, but it's the static address I
picked up from ollydbg, so I'm kinda lost as for how ollydbg
can get the correct string and I get the wrong one using same
address.
You are aware that processes life in differ
On Friday, 30 June 2017 at 16:38:45 UTC, bauss wrote:
Is there a way to retrieve the body of a function as a string?
Scenario.
I want to pass a function to a mixin template and just mixin
the body of the function.
Ex.
mixin template Foo(alias fun) {
void bar() {
mixin(getBodyOfF
On Friday, 30 June 2017 at 16:29:22 UTC, kinke wrote:
On Friday, 30 June 2017 at 16:21:18 UTC, kinke wrote:
CTFE only (incl. parsing of literals). Just make sure you
don't happen to call a std.math function only accepting reals;
I don't know how many of those are still around.
Oh, apparently
On Thursday, 29 June 2017 at 12:02:48 UTC, Simon Bürger wrote:
On Thursday, 29 June 2017 at 00:07:35 UTC, kinke wrote:
On Wednesday, 28 June 2017 at 22:16:48 UTC, Simon Bürger wrote:
I am currently using LDC on 64-bit-Linux if that is relevant.
It is, as LDC on Windows/MSVC would use 64-bit c
On Wednesday, 28 June 2017 at 23:56:42 UTC, Stefan Koch wrote:
As for your problems they can be worked around.
by assigning every temporary to a variable.
Which will enforce the discarding of precision.
Sorry for the misinformation!
I was using the newCTFE fork which fixes this.
Indeed you'll
On Wednesday, 28 June 2017 at 22:16:48 UTC, Simon Bürger wrote:
(If you are interested in the "double double" type, take a look
here:
https://github.com/BrianSwift/MetalQD
which includes a double-double and even quad-double
implementation in C/C++/Fortran)
Nice work can you re or dual licens
On Saturday, 24 June 2017 at 02:52:23 UTC, Felix wrote:
I'm trying to read in just the first part of a .png file to
peek at it's width and height without loading in the whole
file. I'm using FreeImage for reading the whole file but since
it doesn't have a function to let me peek at the image si
On Saturday, 24 June 2017 at 12:22:54 UTC, Petar Kirov
[ZombineDev] wrote:
[ ... ]
/**
* Returns:
* A pointer to a null-terminated string in O(1) time,
* (with regards to the length of the string and the required
* memory, if any) or `null` if * the time constraint
* can't be met.
*/
immu
On Monday, 12 June 2017 at 06:15:07 UTC, Biotronic wrote:
On Monday, 12 June 2017 at 01:36:04 UTC, Stefan Koch wrote:
On Monday, 12 June 2017 at 01:02:58 UTC, helxi wrote:
Is it possible to sum an array in O(1)?
No.
If you want to sum the elements you have to at-least look at
all the element
On Monday, 12 June 2017 at 01:02:58 UTC, helxi wrote:
Is it possible to sum an array in O(1)?
No.
If you want to sum the elements you have to at-least look at all
the elements.
So it'll always be O(N).
it's the best you can do.
On Sunday, 4 June 2017 at 18:13:41 UTC, Russel Winder wrote:
On Sun, 2017-06-04 at 20:31 +0300, ketmar via
Digitalmars-d-learn wrote:
[...]
Sadly even using the correct command, I am not getting any data
that helps infer what the is going on. :-(
[...]
My guess is a null pointer :)
c
On Sunday, 4 June 2017 at 10:45:23 UTC, Nordlöw wrote:
My gmp-d tests successfully on Linux as
dub test
but on OS X it fails as
Undefined symbols for architecture x86_64:
"free", referenced from:
...
"malloc", referenced from:
...
Any ideas on why?
https://github.com/nordlow/gmp-d/is
On Saturday, 3 June 2017 at 16:22:33 UTC, Francis Nixon wrote:
When looking at std.variant I found the following line:
return q{
static if (allowed!%1$s && T.allowed!%1$s)
if (convertsTo!%1$s && other.convertsTo!%1$s)
return VariantN(get!%1$s %2$s other.get!%1$s);
}.form
On Friday, 2 June 2017 at 22:21:07 UTC, Mark wrote:
Hello,
I am trying to make a class that can accept any type as an
argument.
[...]
the stack class needs to be a template as well.
This is not java ;)
On Friday, 2 June 2017 at 17:50:30 UTC, H. S. Teoh wrote:
On Fri, Jun 02, 2017 at 05:22:20PM +, Stefan Koch via
Digitalmars-d-learn wrote:
On Friday, 2 June 2017 at 16:13:03 UTC, Laeeth Isharc wrote:
> [...]
No there is not. First it's woefully incomplete and secondly
it's
On Friday, 2 June 2017 at 16:13:03 UTC, Laeeth Isharc wrote:
On Friday, 2 June 2017 at 02:06:27 UTC, Mike B Johnson wrote:
[...]
Stefan Koch has written a good part of an interpreter for D
AST, no? And I guess the lexing and parsing stage doesn't take
so long, whereas not having to link save
On Friday, 2 June 2017 at 02:32:43 UTC, Mike B Johnson wrote:
1. change test12.wav to test123.wav
2. save file
3. recompile.
4. run
5. Get back to same test point(could be a lot or a little
amount of work).
If that is all you want; then compile your code into a dll/so and
load the new version
On Thursday, 1 June 2017 at 23:24:13 UTC, aberba wrote:
Want to create and load plugins written in D into a D app at
run-time, the kind that can make api calls or extended main app
with other functionality.
I'm currently interested in it for a vibe.d app. How does these
stuff work?
It works
On Wednesday, 31 May 2017 at 18:50:27 UTC, jmh530 wrote:
I have a struct that I am using like a Tuple, but I want to be
able to opIndex in a different way than Tuple's opIndex. I want
to be able to opIndex whatever is underlying the Tuple.
[...]
You could also use string mixins.
Which will b
On Monday, 29 May 2017 at 01:01:46 UTC, Stefan Koch wrote:
There is
void[] myPureMalloc(uint size) pure @trusted nothrow @nogc
{
import core.stdc.stdlib : malloc;
alias pure_malloc_t = @nogc pure nothrow void* function(size_t
size);
return (cast(pure_malloc_t)&malloc)(size)[0 .. siz
On Monday, 29 May 2017 at 00:53:25 UTC, Brad Roberts wrote:
On 5/28/2017 5:34 PM, Jonathan M Davis via Digitalmars-d-learn
wrote:
On Sunday, May 28, 2017 16:49:16 Brad Roberts via
Digitalmars-d-learn wrote:
Is there a mechanism for declaring something pure when it's
built from
parts which indi
On Thursday, 25 May 2017 at 15:02:33 UTC, Oleksii wrote:
Hi everyone,
Could you please help me? I'm get the following error from
all.sh:
$ /e/D/dmd2/windows/bin/shell.exe all.sh
shell 1.05
..\..\windows\bin\dmd d2html
d2html.d(18): Error: module stream is in file 'std\stream.d'
which
On Sunday, 21 May 2017 at 19:33:06 UTC, ParticlePeter wrote:
I am statically linking to ImGui [1] on Win 10 x64, quite
successfully till this issue came up. The noticed error so far
comes when an ImGui function returns an ImVec2, a simple POD
struct of two float members. I can use this struct a
On Sunday, 21 May 2017 at 15:13:55 UTC, bastien penavayre wrote:
I've been trying to translate the following idea expressed here
in c++:
template
void func(Arguments... args) {}
so I tried
void func(UserArgs..., Arguments...)(Arguments args) {}
and then
void func(Args...)(Filter!(isType, A
On Saturday, 20 May 2017 at 08:08:38 UTC, Johan Engelen wrote:
On Saturday, 20 May 2017 at 08:02:26 UTC, lixiaozi wrote:
[...]
I noticed it's the inline optimization in ldc2 that caused the
crash.
If you are certain that your code is 100% correct, please file
a bug report. Inlining is done b
On Friday, 19 May 2017 at 07:29:44 UTC, biocyberman wrote:
I am solving this problem http://rosalind.info/problems/revc/
as an exercise to learn D. This is my solution:
https://dpaste.dzfl.pl/8aa667f962b7
Is there some D tricks I can use to make the
`reverseComplement` function more concise a
On Thursday, 11 May 2017 at 07:24:00 UTC, AntonSotov wrote:
import std.stdio;
int main()
{
auto big = File("bigfile", "r+"); //bigfile size 20 GB
writeln(big.size); // ERROR!
return 0;
}
//
std.exception.ErrnoException@std\stdio.d(1029): Could no
On Wednesday, 10 May 2017 at 16:09:06 UTC, Raiderium wrote:
Heyo,
On 2.074.0, the following test fails with "Error: undefined
identifier 'B' "
unittest
{
class A { B b; }
class B { }
}
I can't figure out if this is intended behaviour. It's making a
template-heavy module diff
On Wednesday, 10 May 2017 at 13:34:30 UTC, Samwise wrote:
I'm really sure this is just a stupid mistake I made, but I
can't for the life of me figure out what is going on. Basically
I'm trying to assign a reference to an object to an array, and
the objects exist (an explicit destructor is writi
On Tuesday, 9 May 2017 at 15:28:20 UTC, WhatMeWorry wrote:
On Monday, 8 May 2017 at 21:16:53 UTC, Igor wrote:
Hi,
I am following Casey Muratori's Handmade Hero and writing it
in DLang.
This sounds very interesting. Maybe make it a public github
project?
It can only accessible for those w
On Sunday, 30 April 2017 at 11:02:52 UTC, Nordlöw wrote:
Have anybody found a way to do transitive packing of bitfields?
For instance, in
import std.bitmanip : bitfields;
struct X
{
// one bit too many to fit in one byte
mixin(bitfields!(bool, `a`, 1,
bool, `b`, 1
On Saturday, 22 April 2017 at 11:33:22 UTC, Andrey wrote:
Hello, I trying to add custom attribute OnClickListener, the
problem is that typeof always return BaseView type instead of
MyView.
struct OnClickListener {
string id;
}
class BaseView {
void onCreate() {
writeln(getSymbo
On Thursday, 13 April 2017 at 21:06:52 UTC, Jesse Phillips wrote:
I realize that this is likely really pushing the compile time
generation but a recent change to the switch statement[1] is
surfacing because of this usage.
uninitswitch2.d(13): Deprecation: 'switch' skips declaration of
variabl
On Sunday, 16 April 2017 at 17:10:14 UTC, Temtaime wrote:
On Sunday, 16 April 2017 at 15:54:16 UTC, Stefan Koch wrote:
On Sunday, 16 April 2017 at 10:56:37 UTC, Era Scarecrow wrote:
On Saturday, 15 April 2017 at 11:10:01 UTC, Stefan Koch wrote:
It would requires an O(n^2) check per declaration
On Sunday, 16 April 2017 at 10:56:37 UTC, Era Scarecrow wrote:
On Saturday, 15 April 2017 at 11:10:01 UTC, Stefan Koch wrote:
It would requires an O(n^2) check per declaration.
Even it is never used.
which would make imports that much more expensive.
Seems wrong to me...
If you made a list/
On Sunday, 16 April 2017 at 08:34:12 UTC, cc wrote:
All this with extern(Windows) rather than extern(C) by the way.
Why not use loadLibraryA ?
then all the problems go away :)
this is how derelict does it as well.
On Saturday, 15 April 2017 at 09:17:08 UTC, Jacob Carlborg wrote:
I'm not sure if I'm missing something obvious here, but the
following code compiles and runs:
void foo() {}
void foo() {}
void main() {}
Although if I do call "foo", the compiler will complain that it
matches both versions of
On Friday, 14 April 2017 at 08:24:00 UTC, Johannes Pfau wrote:
I've got this code duplicated in quite some functions:
-
foreach (member; __traits(derivedMembers, API))
{
// Guards against private members
static if (__traits(compiles, __traits(getMember, API,
member))
On Tuesday, 11 April 2017 at 02:20:37 UTC, Jethro wrote:
ctfe string appending is way to slow, I have tried the
suggested methods and nothing works and slows down by at least
an order of magnitude.
I need a drop in replacement(no other changes) that can take
over the duties of string and allo
On Wednesday, 12 April 2017 at 12:00:27 UTC, Martin Tschierschke
wrote:
It there a way to use "replaceAll" at compile time?
Regards mt.
Not yet :)
I assume it would bring the current system to it's needs.
I you want to experiment you could replace malloc with new.
On Sunday, 9 April 2017 at 20:20:55 UTC, Jethro wrote:
On Sunday, 9 April 2017 at 19:55:57 UTC, Stefan Koch wrote:
On Sunday, 9 April 2017 at 19:38:33 UTC, Jethro wrote:
[...]
The constructor is nuts.
You do not need to zero the string!
Also avoid templates if you can.
Please don't critici
On Sunday, 9 April 2017 at 19:38:33 UTC, Jethro wrote:
I tried to make a string like replacement called fstring which
uses buffering to avoid lots of little allocations. The problem
is, that it actually causes the compiler to use 10x the memory
and about 10 times slower.
It doesn't do anythi
On Sunday, 9 April 2017 at 09:23:07 UTC, Joseph Rushton Wakeling
wrote:
Thanks for the explanation. TBH I find myself wondering
whether `-fPIC` should be in the flags defined in dmd.conf _at
all_ (even for 64-bit environments); surely that should be on
request of individual project builds ..
On Sunday, 9 April 2017 at 05:42:02 UTC, Jethro wrote:
Suppose one has a function that will be used in CTFE and it
uses a lot of local variables. Does each call of the function
end up allocating space for these without ever releasing them
or are they reused? or used on the stack like normal?
101 - 200 of 312 matches
Mail list logo