On Friday, 10 December 2021 at 13:35:37 UTC, Matheus wrote:
I mean this is a bit weird, imagine I have different "for
loops" and in this situation I'll need to do this:
j=0;
for(int i=0;i<10;++i){}
Otherwise:
for(i=0,j=0;i<10;++i){}
This works, but now "i" variable will be out of the "for
On Friday, 10 December 2021 at 22:35:58 UTC, Arjan wrote:
"abc;def;ghi".tr(";", "", "d" );
I don't think we have enough ways of doing the same thing yet...
so here's one more..
"abc;def;ghi".substitute(";", "");
On Friday, 10 December 2021 at 18:47:53 UTC, Stanislav Blinov
wrote:
Oooh, finally someone suggested to preallocate storage for all
these reinventions of the wheel :D
```
import std.stdio;
char[] dontdothis(string s, int i=0, int skip=0){
if (s.length == i) return new char[](i - skip);
On Friday, 10 December 2021 at 06:24:27 UTC, Rumbu wrote:
On Wednesday, 8 December 2021 at 11:23:45 UTC, BoQsc wrote:
Let's say I want to skip characters and build a new string.
The character I want to skip: `;`
Expected result:
```
abcdefab
```
Since it seems there is a contest here:
```d
On Friday, 10 December 2021 at 12:15:18 UTC, Rumbu wrote:
I thought it's a beauty contest.
Well, if it's a beauty contest, then i got a beauty..
char[("abc;def;ab".length - count("abc;def;ab", ";"))] b =
"abc;def;ab".replace(";", "");
On Friday, 10 December 2021 at 13:35:37 UTC, Matheus wrote:
Hi,
Wouldn't the compiler be smart with this shadowing variable,
example:
void main(){
int j;
for(int i=0,j=0;i<10;++i){}
return;
}
onlineapp.d(3): Error: variable `j` is shadowing variable
`onlineapp.main.j`
So in
Yes it will. You can use lazy templates instead, like splitter and joiner,
which splits and joins lazily, respectively. LDC can optimize those templates
fairly well and avoid too much lazy calls and pretty much constructs the logic
equivalent to for loop.
On 10 December 2021 11:06:21 WET,
On Friday, 10 December 2021 at 18:47:53 UTC, Stanislav Blinov
wrote:
Be interesting to see if this thread does evolve into a SIMD
http://lemire.me/blog/2017/01/20/how-quickly-can-you-remove-spaces-from-a-string/
On Friday, 10 December 2021 at 13:22:58 UTC, Matheus wrote:
My C way of thinking while using D:
import std;
string stripsemicolons(string input){
char[] s = input.dup;
int j=0;
for(int i=0;i
Oooh, finally someone suggested to preallocate storage for all
these reinventions of
On Friday, 10 December 2021 at 16:42:33 UTC, Tim wrote:
All virtual methods have to match exactly including order. If a
virtual method is missing or added, then calling this or a
later virtual method could call the wrong method or generate a
segmentation fault. Non-virtual methods have to be
On Friday, 10 December 2021 at 12:46:07 UTC, rempas wrote:
On Thursday, 9 December 2021 at 21:35:14 UTC, Tim wrote:
Methods, which are not virtual in C++, also have to be marked
final in D, because C++ and D use a different default.
Is this a must or just good practices?
All virtual methods
On Friday, 10 December 2021 at 14:13:53 UTC, kdevel wrote:
On https://code.dlang.org/packages/dpq2 I clicked at
https://dpq2.dpldocs.info/v1.0.23/ and got:
try it now
the server ran out of disk space yesterday and threw some things
off so i have to hit retry on a few of them (or like the
On https://code.dlang.org/packages/dpq2 I clicked at
https://dpq2.dpldocs.info/v1.0.23/ and got:
```
Downloading package info...
Downloading source code for version v1.0.23 from
https://github.com/denizzzka/dpq2/archive/v1.0.23.zip...
Unzipping D files...
Generating documentation... this may
Hi,
Wouldn't the compiler be smart with this shadowing variable,
example:
void main(){
int j;
for(int i=0,j=0;i<10;++i){}
return;
}
onlineapp.d(3): Error: variable `j` is shadowing variable
`onlineapp.main.j`
So in the "for loop" shouldn't "i" be declared and "j" just be
On Wednesday, 8 December 2021 at 11:23:45 UTC, BoQsc wrote:
...
The character I want to skip: `;`
My C way of thinking while using D:
import std;
string stripsemicolons(string input){
char[] s = input.dup;
int j=0;
for(int i=0;i
On Thursday, 9 December 2021 at 21:35:14 UTC, Tim wrote:
The referenced methods like Fl_Widget::_clear_fullscreen are
implemented directly in the header, so the D code also needs
the implementation, because it is not included in the compiled
library.
What is funny about that is that I
On Friday, 10 December 2021 at 11:06:21 UTC, IGotD- wrote:
On Friday, 10 December 2021 at 06:24:27 UTC, Rumbu wrote:
Since it seems there is a contest here:
```d
"abc;def;ghi".split(';').join();
```
:)
Would that become two for loops or not?
I thought it's a beauty contest.
```d
string
On Friday, 10 December 2021 at 06:24:27 UTC, Rumbu wrote:
Since it seems there is a contest here:
```d
"abc;def;ghi".split(';').join();
```
:)
Would that become two for loops or not?
18 matches
Mail list logo