What do you think about using Chat GPT to create functions in D?

Marcone marcone at email.com
Mon Apr 3 23:38:52 UTC 2023


What do you think about using Chat GPT to create functions in D? 
I asked Chat-GPT to create a function in D that was similar to 
the rsplit() function in Python. It returned this code to me:


import std.algorithm;
import std.array;
import std.string;

string[] rsplit(string input, string separator, size_t maxsplit = 
size_t.max) {
     auto splitter = splitter(input, separator, SplitterFlag.all);
     auto results = splitter.array;
     if (maxsplit < results.length - 1)
         results = results[results.length - maxsplit - 1 .. $];
     return results;
}



More information about the Digitalmars-d-learn mailing list