On Tuesday, 11 June 2024 at 09:48:36 UTC, madwebness wrote:
On Tuesday, 11 June 2024 at 09:29:05 UTC, madwebness wrote:
My version that runs:
Ran the code exactly as you posted. It works and I found the
issue. Apparently, if I add =* to the end of the last element,
the assertion fails with t
On Tuesday, 11 June 2024 at 09:29:05 UTC, madwebness wrote:
My version that runs:
Ran the code exactly as you posted. It works and I found the
issue. Apparently, if I add =* to the end of the last element,
the assertion fails with the error.
```
auto words = ["HELLO", "world", "hi", "ENDOFT
On Tuesday, 11 June 2024 at 09:17:21 UTC, madwebness wrote:
While I do understand what you're saying, I'm not sure I
understand how to fix the code.
With the following function definition what the function returns
is correct and the problem is in the unittest code. Note that
`writeln()` print
On Tuesday, 11 June 2024 at 08:44:25 UTC, Richard (Rikki) Andrew
Cattermole wrote:
There are two more corrections to make.
Both in sliceIt.
Note: array is a function not a type and is for ranges, slices
are built in language concept. Associate Arrays (map) use the
syntax ``Type[Type]``.
Whi
On Tuesday, 11 June 2024 at 08:29:06 UTC, madwebness wrote:
unittest {
auto words = ["HELLO", "world", "hi", "ENDOFTHERUNWAY"];
auto resulting_arr = sliceIt(["world", "hi"]);
assert(resulting_arr == ["world", "hi"]);
}
Correction here, I, of course, meant:
```
auto resulting_arr = slice
I was following the documentation here:
http://dlang.org.mirror/spec/arrays.html#slicing and I'm having a
problem comparing the returned Slice from a function with an
array.
Here's the simplified code:
```
import std.stdio;
import std.regex;
import std.string;
import std.array;
auto sliceIt(