On Thursday, 8 April 2021 at 04:02:26 UTC, Ali Çehreli wrote:
On 4/7/21 8:57 PM, Brad wrote:
auto a = [1,0,1,1,1,0,1,0,1,1,1,1,0];
I want to come out of this with a string that looks like this:
101110100
Me, me, me, me! :)
import std;
void main()
{
auto a =
On Tuesday, 19 January 2021 at 11:25:13 UTC, Ola Fosheim Grøstad
wrote:
On Tuesday, 19 January 2021 at 10:43:45 UTC, Ola Fosheim
Grøstad wrote:
On Tuesday, 19 January 2021 at 10:36:13 UTC, ddcovery wrote:
GC if D is not enough for you), but think about the thousands
of experienced developers
On Monday, 18 January 2021 at 15:18:40 UTC, aberba wrote:
From my experiencing freelancing, I've come to see that a large
portion of clients' decision stems from other things like
familiarity and ecosystem (packages, frameworks, vendor/cloud
support, engineering hiring pool,
On Friday, 15 January 2021 at 14:25:09 UTC, Steven Schveighoffer
wrote:
On 1/15/21 9:19 AM, Steven Schveighoffer wrote:
Something similar to BlackHole or WhiteHole. Essentially
there's a default action for null for all
types/fields/methods, and everything else is passed through.
And now
On Friday, 15 January 2021 at 14:19:35 UTC, Steven Schveighoffer
wrote:
On 1/14/21 7:27 PM, ddcovery wrote:
On Thursday, 14 January 2021 at 20:23:08 UTC, Steven
Schveighoffer wrote:
You could kinda automate it like:
struct NullCheck(T)
{
private T* _val;
auto opDispatch(string mem)()
On Thursday, 14 January 2021 at 18:24:44 UTC, ddcovery wrote:
I know there is other threads about null safety and the
"possible" ways to support this in D and so on.
This is only an open question to know what code patterns you
usually use to solve this situation in D
I'm writing a
On Thursday, 14 January 2021 at 20:35:49 UTC, Dennis wrote:
On Thursday, 14 January 2021 at 18:24:44 UTC, ddcovery wrote:
If it's not a bother, I'd like to know how you usually
approach it
Usually I don't deal with null because my functions get
primitive types, slices, or structs. `ref`
On Thursday, 14 January 2021 at 20:23:08 UTC, Steven
Schveighoffer wrote:
You could kinda automate it like:
struct NullCheck(T)
{
private T* _val;
auto opDispatch(string mem)() if (__traits(hasMember, T,
mem)) {
alias Ret = typeof(() { return __traits(getMember,
*_val, mem);
On Thursday, 14 January 2021 at 21:49:41 UTC, Christian Köstlin
wrote:
...
Did you have a look at https://code.dlang.org/packages/optional?
Especially
https://aliak00.github.io/optional/optional/oc/oc.html might go
in the right direction.
Kind regards,
Christian
Thats nice!!!
I was
On Thursday, 14 January 2021 at 19:24:54 UTC, Adam D. Ruppe wrote:
On Thursday, 14 January 2021 at 18:24:44 UTC, ddcovery wrote:
This is only an open question to know what code patterns you
usually use to solve this situation in D:
I'm almost never in this situation except for reading things
I know there is other threads about null safety and the
"possible" ways to support this in D and so on.
This is only an open question to know what code patterns you
usually use to solve this situation in D:
if(person.father.father.name == "Peter") doSomething();
if(person.father.age > 80
On Thursday, 14 January 2021 at 10:28:13 UTC, Basile B. wrote:
On Wednesday, 13 January 2021 at 18:58:56 UTC, Marcone wrote:
I've always heard programmers complain about Garbage Collector
GC. But I never understood why they complain. What's bad about
GC?
Semi serious answer:
In the domain
On Tuesday, 12 January 2021 at 21:37:11 UTC, Jack wrote:
I was looking for a way to avoid null checks everywhere. I was
checking the Null object pattern, or use something like enforce
pattern, or even if I could make a new operator and implement
something like C#'s .? operator, that Java was
On Wednesday, 13 January 2021 at 09:02:37 UTC, ddcovery wrote:
Find more details here:
https://run.dlang.io/gist/392c06e745d1a35df71084ce4d29fed7
Ups... it seems that the link is not working (it is the first
time I try to generate a dalng/gist link... I'm not sure if this
can really be
On Tuesday, 12 January 2021 at 21:37:11 UTC, Jack wrote:
I was looking for a way to avoid null checks everywhere. I was
checking the Null object pattern, or use something like enforce
pattern, or even if I could make a new operator and implement
something like C#'s .? operator, that Java was
On Tuesday, 15 December 2020 at 19:53:33 UTC, Q. Schroll wrote:
On Monday, 14 December 2020 at 14:39:14 UTC, ddcovery wrote:
On Monday, 14 December 2020 at 12:22:26 UTC, ddcovery wrote:
int opCmp(Number other){
return _value - other.value;
};
Correction:
bool opEquals(Number
On Monday, 14 December 2020 at 12:22:26 UTC, ddcovery wrote:
int opCmp(Number other){
return _value - other.value;
};
Correction:
bool opEquals(Number other){
return _value == other.value;
};
In this example, I try to use D Voldemore (fantastic)
functionallity to implement a pattern usually used in javascript.
Basically, a function closure represents the state, and the
methods to access this state are returned in the form of union
(union has not state itself).
void main(){
On Wednesday, 2 December 2020 at 06:31:49 UTC, H. S. Teoh wrote:
On Tue, Dec 01, 2020 at 10:49:55PM +, ddcovery via
Digitalmars-d-learn wrote:
Yesterday I really shocked when, comparing one algorithm
written in javascript and the equivalent in D, javascript
performed better
On Tuesday, 1 December 2020 at 23:43:31 UTC, Max Haughton wrote:
On Tuesday, 1 December 2020 at 22:49:55 UTC, ddcovery wrote:
Yesterday I really shocked when, comparing one algorithm
written in javascript and the equivalent in D, javascript
performed better!!!
[...]
Use ldc, rdmd can
On Tuesday, 1 December 2020 at 22:49:55 UTC, ddcovery wrote:
Yesterday I really shocked when, comparing one algorithm
written in javascript and the equivalent in D, javascript
performed better!!!
[...]
Sorry about title (may be "doubt" :-/ )
Yesterday I really shocked when, comparing one algorithm written
in javascript and the equivalent in D, javascript performed
better!!!
The idea is to translate the "3 lines sort" in haskell to
Javascript and D (with the limitations of each language). This
is not a quick sort test, but a
On Friday, 27 November 2020 at 20:53:37 UTC, Ali Çehreli wrote:
This has been done with the Y-combinator, where the lambda
refers to itself as 'self':
https://github.com/gecko0307/atrium/blob/master/dlib/functional/combinators.d
There has been been other discussions on it on these forums.
On Friday, 27 November 2020 at 16:40:43 UTC, ddcovery wrote:
...
* Can the lambda be transformed to a template (using T instead
"int") but avoiding function/return syntax?
This is an example using function
template qs(T){
T[] qs( T[] items ){
return items.length==0
?
I want to express in D the known Haskell qsort 3 lines code (it
is not a quick sort, but an example of how functional programming
is expressive).
This is the "javascript" version I use as reference:
const sorted = ( [pivot, …others] ) => pivot===void 0 ? [ ] :
[
… sorted(
On Wednesday, 25 November 2020 at 12:28:20 UTC, Paul Backus wrote:
Maybe this is the one you're thinking of?
https://www.informit.com/articles/article.aspx?p=1407357
Ye, it is.
Thank you very much Paul.
Months ago I read an Andrei article explaining why Ranges
(comparing with C++). I remember article introduction included a
python "false" quick-sort algorithm.
I'm really interested in a more detailed read of the article, but
I can't find it. If some one can post the link :-)
Thank you
On Sunday, 11 October 2020 at 11:56:29 UTC, Robert M. Münch wrote:
Well, for us it's getting more and more clear, that a decision
what to use in the future will be based on less and less
technical aspects.
The interesting thing about Go is, that their main focus is
thinking from an
On Wednesday, 7 October 2020 at 19:15:42 UTC, aberba wrote:
It seems the D ecosystem is not immediately obvious to some
people. Dub, compilers, and IDEs are recurring issues.
and debbuging (particularly inspection)
On Thursday, 1 October 2020 at 06:32:23 UTC, Robert M. Münch
wrote:
Hi, we are currently using vibe.d for a prototype and I want to
post some experiences. I know one shouldn't only address the
problems but provide some solutions.
However, our current use-case is that we want to get a job
On Sunday, 27 September 2020 at 21:41:25 UTC, Adam D. Ruppe wrote:
On Sunday, 27 September 2020 at 21:38:43 UTC, ddcovery wrote:
i.e. checking this Regex expression
`^[a-zA-Z_]*[a-zA-Z0-9_]*[a-zA-Z][a-zA-Z0-9_]*$`
Is there any way to check a regular expression at compile time?
Not really
I have a "variation" of "unaryFun" that I name "unaryProp" that,
basically, doesn't require to specify "a." at the beginning of
the expression.
template unaryProp(alias propName)
{
static assert(is(typeof(propName) : string), "Sorry, propName
must be an string");
auto
I think I will dedicate tonight one or two hours to understand
the first two proposals :-D.
On Thursday, 24 September 2020 at 13:28:25 UTC, WebFreak001 wrote:
[...]
Alternatively a lot easier would be to just return auto and do:
auto dt(alias fun, T)(Dot!T t){
return t.dot(t =>
On Thursday, 24 September 2020 at 14:15:01 UTC, ddcovery wrote:
[...]
I think I will dedicate tonight one or two hours to understand
the first two proposals :-D.
[...]
Not necessary, really simple and well explained WebFreak001!!!
Last week, in general forum someone introduced the possibility to
implement the .? operator in D:
https://forum.dlang.org/thread/blnjoaleswqnaojou...@forum.dlang.org
I decided to implement a simple solution with a funciontal syntax:
string fatherName =
On Friday, 21 August 2020 at 08:48:34 UTC, ddcovery wrote:
On Thursday, 20 August 2020 at 21:36:04 UTC, Andre Pany wrote:
[...]
Thanks a lot Andre,
I opened immediately the issues to receive some feedback:
[...]
EDIT: 23 days ago new vibe.d (0.9.0) was released... Testing with
it memory
On Thursday, 20 August 2020 at 21:36:04 UTC, Andre Pany wrote:
On Thursday, 20 August 2020 at 18:13:46 UTC, ddcovery wrote:
On Monday, 17 August 2020 at 15:45:05 UTC, aberba wrote:
[...]
After 18 years following DLang, and some disagrees about
productivity lacks at the beggining (no IDE,
"After 18 years following DLang," its not well expressed...may be
"at first Dlang stages, after 2 years following its evolution,
and ..."
On Monday, 17 August 2020 at 15:45:05 UTC, aberba wrote:
On Thursday, 13 August 2020 at 09:54:06 UTC, Mr. Backup wrote:
On Wednesday, 12 August 2020 at 13:46:06 UTC, James Blachly
wrote:
Unfortunately the problem still occurs with Vibe.d 0.9.0
IMO **this is the single most important problem
39 matches
Mail list logo