On Wednesday, 3 November 2021 at 01:39:02 UTC, H. S. Teoh wrote:
On Wed, Nov 03, 2021 at 01:33:28AM +, dangbinghoo via
Digitalmars-d-learn wrote:
On Wednesday, 3 November 2021 at 00:50:31 UTC, pascal111 wrote:
> How can I include "ncurses" liberary in D? I'm using Ubuntu
> and GDC!
On Monday, 1 November 2021 at 21:32:21 UTC, Ali Çehreli wrote:
Joking aside, I liked the nested struct and its opAssign to
mimic internal `arr.length = 42` syntax. (I know it involves a
potentially expensive delegate but still...)
The nested struct is not needed. UFCS works for setters, too:
On 11/2/21 6:49 PM, zjh wrote:
On Tuesday, 2 November 2021 at 23:02:42 UTC, Ali Çehreli wrote:
On 11/2/21 3:57 PM, Ali Çehreli wrote:
const x = readln.strip;
this is very interesting .`readln` then `strip;`,Very natural.
Yes, UFCS (universal function call syntax) makes code natural,
On 11/1/21 9:03 PM, pascal111 wrote:
On Monday, 1 November 2021 at 21:32:21 UTC, Ali Çehreli wrote:
Joking aside
...
This function seems smart and flexible and higher than my current level,
I'll study it.
Please please, do NOT study this code. It is bad all around. Ali should
know
On Tuesday, 2 November 2021 at 23:02:42 UTC, Ali Çehreli wrote:
On 11/2/21 3:57 PM, Ali Çehreli wrote:
const x = readln.strip;
this is very interesting .`readln` then `strip;`,Very natural.
On Wed, Nov 03, 2021 at 01:33:28AM +, dangbinghoo via Digitalmars-d-learn
wrote:
> On Wednesday, 3 November 2021 at 00:50:31 UTC, pascal111 wrote:
> > How can I include "ncurses" liberary in D? I'm using Ubuntu and GDC!
>
> Search ncurses in Dub registray shows that there's 3 ncurses D
>
On Wednesday, 3 November 2021 at 00:50:31 UTC, pascal111 wrote:
How can I include "ncurses" liberary in D? I'm using Ubuntu and
GDC!
Search ncurses in Dub registray shows that there's 3 ncurses D
bingdings.
https://code.dlang.org/search?q=ncurses
On Wednesday, 3 November 2021 at 00:57:38 UTC, Ali Çehreli wrote:
On 11/2/21 5:50 PM, Siarhei Siamashka wrote:
Your code can be changed to something like this:
And I over-engineered it. :)
import std.stdio;
import std.algorithm;
import std.range;
import std.exception;
import std.format;
.
.
On Wednesday, 3 November 2021 at 00:50:51 UTC, Siarhei Siamashka
wrote:
On Tuesday, 2 November 2021 at 23:45:39 UTC, pascal111 wrote:
By "vertical" vs. "horizontal" thinking, do you mean imperative
vs. functional style?
On 11/2/21 5:50 PM, Siarhei Siamashka wrote:
Your code can be changed to
something like this:
And I over-engineered it. :)
import std.stdio;
import std.algorithm;
import std.range;
import std.exception;
import std.format;
// A readable name; corresponds to C's typedef
alias FilterFunction =
On Wednesday, 3 November 2021 at 00:50:51 UTC, Siarhei Siamashka
wrote:
On Tuesday, 2 November 2021 at 23:45:39 UTC, pascal111 wrote:
It's supported in many modern programming languages and it's
not a unique feature of the D language alone. Your code can be
changed to something like this:
On Tuesday, 2 November 2021 at 23:45:39 UTC, pascal111 wrote:
Next code originally was a classic C code I've written, it's
pure vertical thinking, now, I converted it successfully to D
code, but I think I made no much changes to make it has more
horizontal thinking style that it seems D
How can I include "ncurses" liberary in D? I'm using Ubuntu and
GDC!
Next code originally was a classic C code I've written, it's pure
vertical thinking, now, I converted it successfully to D code,
but I think I made no much changes to make it has more horizontal
thinking style that it seems D programmers care in horizontal
thinking style. Is there any
On Tuesday, 2 November 2021 at 23:02:42 UTC, Ali Çehreli wrote:
On 11/2/21 3:57 PM, Ali Çehreli wrote:
Here is a more idiomatic version:
import std.stdio;
import std.string;
void main() {
const x = strip(readln());
writeln(x);
if (x == "hello world!") {
writeln("yes");
}
}
The
On Tuesday, 2 November 2021 at 22:57:14 UTC, Ali Çehreli wrote:
On 11/2/21 3:36 PM, pascal111 wrote:
can we keep the C style of it as it is
As you hint, this really is not D but still... :) I had to make
three changes:
import std.stdio;
// Ali - Importing stdin under a different name
// to
On 11/2/21 3:57 PM, Ali Çehreli wrote:
Here is a more idiomatic version:
import std.stdio;
import std.string;
void main() {
const x = strip(readln());
writeln(x);
if (x == "hello world!") {
writeln("yes");
}
}
The first line in main can be written with UFCS syntax as well:
On 11/2/21 3:36 PM, pascal111 wrote:
can we keep the C style of it as it is
As you hint, this really is not D but still... :) I had to make three
changes:
import std.stdio;
// Ali - Importing stdin under a different name
// to prevent name conflict with std.stdio.stdin;
import
In next program I intend it to be the D version of a C program,
but I found some troubles with it, can we keep the C style of it
as it is as we can and fix the must-be-fixed parts to make it
works under D compiler?
// D programming language
import std.stdio;
import core.stdc.stdio;
import
On Friday, 29 October 2021 at 17:29:57 UTC, harakim wrote:
On Sunday, 24 October 2021 at 05:46:48 UTC, Dr Machine Code
wrote:
I'd like that to some friends getting start with programming.
Sadly that platform doesn't support D.
I wouldn't mind helping out by reviewing code or answering
On 11/2/21 9:35 AM, pascal111 wrote:
> "input..." seems nice, where can I get more information about it?
I include most of the language in this free book:
http://ddili.org/ders/d.en/index.html
which has an Index Section that I find useful to locate information:
On Tuesday, 2 November 2021 at 16:35:40 UTC, pascal111 wrote:
"input..." seems nice, where can I get more information about
it?
"Typesafe variadic functions"
https://dlang.org/spec/function.html#typesafe_variadic_functions
On Tuesday, 2 November 2021 at 16:29:07 UTC, rikki cattermole
wrote:
You probably don't want to be using C variadics.
Instead try the typed one:
float mean(float[] input...) {
// you don't want to divide by zero
if (input.length == 0)
return 0;
float
You probably don't want to be using C variadics.
Instead try the typed one:
float mean(float[] input...) {
// you don't want to divide by zero
if (input.length == 0)
return 0;
float temp = 0;
// floats and double initialize to NaN by default, not
I'm programming average calculating function by using Variadic
Functions method, but I didn't get yet what is the wrong in my
code:
// D programming language
import std.stdio;
import core.vararg;
import std.conv;
float foo(...)
{
float x=0;
for(int i=0; i<_arguments.length; ++i){
On Monday, 1 November 2021 at 16:16:12 UTC, Arsium wrote:
On Monday, 1 November 2021 at 16:02:20 UTC, Paul Backus wrote:
On Monday, 1 November 2021 at 16:00:05 UTC, Arsium wrote:
Hello,
Currently, I'm working to implement myself WinAPI functions.
However, I could not find anything matching
26 matches
Mail list logo