D-Programming-Language/phobos — pull request #1259 by someboddy (2013-04-16 20:50:40+00:00)
Title: fix issue 9942 - Add a functional switch function

Based on `condp` from Clojure(http://clojuredocs.org/clojure_core/1.2.0/clojure.core/condp), I've written the function `predSwitch`. It acts as the functional(=expression) version of the `switch` statement, and it also allows a custom predicate:
```D
assert(2.predSwitch!"a < b"(
1, "less then 1",
5, "less then 5",
10, "less then 10",
"greater or equal to 10") == "less then 5");
```

See http://d.puremagic.com/issues/show_bug.cgi?id=9942

P.S.: I'm not sure it's place is in `std.algorithm`, but it does not fit in any other module.