On Sunday, 11 October 2015 at 11:17:29 UTC, Nordlöw wrote:
Here's a solution:
https://github.com/nordlow/justd/blob/f8519e8a1af68bc25cc00c6ef12d13efa791250c/comparison_ex.d
Latest version contains a few fixes:
https://github.com/nordlow/justd/blob/master/comparison_ex.d
On Saturday, 10 October 2015 at 16:19:53 UTC, Nordlöw wrote:
Is there an algorithm somewhere in Phobos which performs when
possible a replacement/substitution based on a variadic
definition of replacements using hash-table search similar to
string replaceWhole(string a)
{
switch (x)
{
On Sunday, 11 October 2015 at 05:06:04 UTC, Nordlöw wrote:
On Sunday, 11 October 2015 at 00:16:44 UTC, Meta wrote:
There was something like this proposed quite awhile ago (can't
remember what it was, might've been extending unary/binaryFun
to accept an AA), but it was rejected.
With static fo
On Sunday, 11 October 2015 at 00:16:44 UTC, Meta wrote:
There was something like this proposed quite awhile ago (can't
remember what it was, might've been extending unary/binaryFun
to accept an AA), but it was rejected.
With static foreach in a switch we can do better. I'll put
together a sol
On Saturday, 10 October 2015 at 16:19:53 UTC, Nordlöw wrote:
Is there an algorithm somewhere in Phobos which performs when
possible a replacement/substitution based on a variadic
definition of replacements using hash-table search similar to
string replaceWhole(string a)
{
switch (x)
{
On Saturday, 10 October 2015 at 16:42:52 UTC, Nordlöw wrote:
Found it:
http://dlang.org/phobos/std_algorithm_comparison.html#predSwitch
An alias would be perhaps be motivated to make newcomers easier
grap that this can be used for whole replacements.
Ahh, but this doesn't use a hash-table be
On Saturday, 10 October 2015 at 16:19:53 UTC, Nordlöw wrote:
Is there an algorithm somewhere in Phobos which performs when
possible a replacement/substitution based on a variadic
definition of replacements using hash-table search similar to
Found it:
http://dlang.org/phobos/std_algorithm_comp
Is there an algorithm somewhere in Phobos which performs when
possible a replacement/substitution based on a variadic
definition of replacements using hash-table search similar to
string replaceWhole(string a)
{
switch (x)
{
case "a": return "1";
case "b": return "2";
defaul