On Tuesday, 11 December 2018 at 14:53:02 UTC, Steven
Schveighoffer wrote:
On 12/11/18 9:47 AM, Narxa wrote:
On Tuesday, 11 December 2018 at 14:22:30 UTC, Adam D. Ruppe
wrote:
On Tuesday, 11 December 2018 at 14:16:05 UTC, Narxa wrote:
int var = floor(sqrt(n)) // where 'n' is a 'const int'
On Tuesday, 11 December 2018 at 14:22:30 UTC, Adam D. Ruppe wrote:
On Tuesday, 11 December 2018 at 14:16:05 UTC, Narxa wrote:
int var = floor(sqrt(n)) // where 'n' is a 'const int'
You can just cast it to float:
floor(sqrt( cast(float) n ));
and it will work.
It produced the following
On 12/11/18 10:27 AM, Ron Tarrant wrote:
I ran across a code example
(https://github.com/gtkd-developers/GtkD/blob/master/demos/gtkD/TestWindow/TestWindow.d)
in which the first ~120 lines are mostly import statements.
And it got me wondering...
I tried to off-load a bunch of imports into a
On Tuesday, 11 December 2018 at 15:39:18 UTC, Steven
Schveighoffer wrote:
Use public imports in your header file. This will pretend that
the symbols imported reside in the module itself.
i.e. inside importedStuff.d:
public {
// 120 import statements
}
-Steve
Thanks, Steve. Works like
On 12/11/18 9:47 AM, Narxa wrote:
On Tuesday, 11 December 2018 at 14:22:30 UTC, Adam D. Ruppe wrote:
On Tuesday, 11 December 2018 at 14:16:05 UTC, Narxa wrote:
int var = floor(sqrt(n)) // where 'n' is a 'const int'
You can just cast it to float:
floor(sqrt( cast(float) n ));
and it will
On Tuesday, 11 December 2018 at 15:17:10 UTC, Narxa wrote:
Yes, it worked:
---
int var = cast(int) floor(sqrt( cast(float) n ));
I thought floor already returned an 'int' but I was mistaken.
Thank you very much.
I think you don't need floor.
int var =
I ran across a code example
(https://github.com/gtkd-developers/GtkD/blob/master/demos/gtkD/TestWindow/TestWindow.d) in which the first ~120 lines are mostly import statements.
And it got me wondering...
I tried to off-load a bunch of imports into a pseudo-header file
— importedStuff.d — and
On Tuesday, 11 December 2018 at 07:25:49 UTC, Seb wrote:
On Monday, 10 December 2018 at 00:18:52 UTC, Murilo wrote:
Hi guys, thank you for helping me out here, there is this
facebook group for the D language, here we can help and teach
each other. It is called Programming in D. Please join.
On Tuesday, December 11, 2018 2:11:49 PM MST H. S. Teoh via Digitalmars-d-
learn wrote:
> On Tue, Dec 11, 2018 at 09:02:41PM +, bauss via Digitalmars-d-learn
wrote:
> > On Tuesday, 11 December 2018 at 18:10:48 UTC, H. S. Teoh wrote:
> [...]
>
> > > Autodecoding raises its ugly head again. :-/
On Tuesday, 11 December 2018 at 17:51:56 UTC, Denis Feklushkin
wrote:
import std.stdio;
import std.range.primitives;
void main()
{
writeln(
typeid(ElementType!(char[2]))
);
static assert(is(ElementType!(char[2]) == dchar)); // why?
}
?
https://run.dlang.io/is/Q74yHm
On Wed, Dec 12, 2018 at 06:56:46AM +1300, rikki cattermole via
Digitalmars-d-learn wrote:
> On 12/12/2018 6:51 AM, Denis Feklushkin wrote:
> > import std.stdio;
> > import std.range.primitives;
> >
> > void main()
> > {
> > writeln(
> > typeid(ElementType!(char[2]))
> > );
> >
On Tuesday, 11 December 2018 at 08:20:32 UTC, Arun Chandrasekaran
wrote:
A typical example would be to split the HTTP query string into
an AA.
vibe.d has req.queryString, but no convenient wrapper to access
it as an AA.
http://localhost/hello?name=abc=123
I've got this far.
auto
P.S. Just looked at the disassembly. Seems to be a codegen bug -- the
code appears to be trying to lookup local variables (presumably i0 and
i1), but somehow the initialization code is missing.
--T
On Tue, Dec 11, 2018 at 09:09:55PM +, Johannes Riecken via
Digitalmars-d-learn wrote:
>
On 12/12/2018 6:51 AM, Denis Feklushkin wrote:
import std.stdio;
import std.range.primitives;
void main()
{
writeln(
typeid(ElementType!(char[2]))
);
static assert(is(ElementType!(char[2]) == dchar)); // why?
}
?
https://run.dlang.io/is/Q74yHm
Because docs:
On Tuesday, 11 December 2018 at 18:10:48 UTC, H. S. Teoh wrote:
On Wed, Dec 12, 2018 at 06:56:46AM +1300, rikki cattermole via
Digitalmars-d-learn wrote:
On 12/12/2018 6:51 AM, Denis Feklushkin wrote:
> import std.stdio;
> import std.range.primitives;
>
> void main()
> {
> writeln(
>
Code:
import std.conv;
import std.stdio;
mixin template genInts()
{
enum arr = [0,1];
static foreach (t; arr) {
mixin("int i" ~ to!string(t) ~ " = 5;");
}
}
void main() {
mixin genInts!();
writeln(i0);
writeln(i1);
}
Expected output:
5
5
Actual output is two garbage integer
On Tuesday, 11 December 2018 at 18:46:27 UTC, Andre Pany wrote:
I am not 100% sure but I think query parameters names can occur
multiple times in query string.
Yes, that's right.
On 12/11/18 4:09 PM, Johannes Riecken wrote:
Code:
import std.conv;
import std.stdio;
mixin template genInts()
{
enum arr = [0,1];
static foreach (t; arr) {
mixin("int i" ~ to!string(t) ~ " = 5;");
}
}
void main() {
mixin genInts!();
writeln(i0);
writeln(i1);
}
On Tue, Dec 11, 2018 at 09:09:55PM +, Johannes Riecken via
Digitalmars-d-learn wrote:
> Code:
>
> import std.conv;
> import std.stdio;
>
> mixin template genInts()
> {
> enum arr = [0,1];
> static foreach (t; arr) {
> mixin("int i" ~ to!string(t) ~ " = 5;");
> }
> }
>
> void
On 12/11/18 3:20 AM, Arun Chandrasekaran wrote:
A typical example would be to split the HTTP query string into an AA.
vibe.d has req.queryString, but no convenient wrapper to access it as an
AA.
Yeah it does:
http://vibed.org/api/vibe.http.server/HTTPServerRequest.query
-Steve
On Tue, Dec 11, 2018 at 09:02:41PM +, bauss via Digitalmars-d-learn wrote:
> On Tuesday, 11 December 2018 at 18:10:48 UTC, H. S. Teoh wrote:
[...]
> > Autodecoding raises its ugly head again. :-/
[...]
> Has it ever had anything else?
LOL... well, we (or some of us) were deceived by its
On Tuesday, 11 December 2018 at 08:20:32 UTC, Arun Chandrasekaran
wrote:
A typical example would be to split the HTTP query string into
an AA.
vibe.d has req.queryString, but no convenient wrapper to access
it as an AA.
http://localhost/hello?name=abc=123
I've got this far.
auto
A typical example would be to split the HTTP query string into an
AA.
vibe.d has req.queryString, but no convenient wrapper to access
it as an AA.
http://localhost/hello?name=abc=123
I've got this far.
auto arr = req.queryString.splitter('&').map!(a =>
a.splitter('='));
Thanks
import std.stdio;
import std.range.primitives;
void main()
{
writeln(
typeid(ElementType!(char[2]))
);
static assert(is(ElementType!(char[2]) == dchar)); // why?
}
?
https://run.dlang.io/is/Q74yHm
Hello, people!
The following case:
---
int var = floor(sqrt(n)) // where 'n' is a 'const int'
Produces the following error:
-
Error: std.math.sqrt called with argument types (const(int))
matches both:
/usr/include/dmd/phobos/std/math.d(2067):
On Tuesday, 11 December 2018 at 14:16:05 UTC, Narxa wrote:
int var = floor(sqrt(n)) // where 'n' is a 'const int'
You can just cast it to float:
floor(sqrt( cast(float) n ));
and it will work.
26 matches
Mail list logo