Skip to content

Instantly share code, notes, and snippets.

@ShigekiKarita
Created November 1, 2014 10:14
Show Gist options
  • Save ShigekiKarita/6703c4fff03b27b5d4fa to your computer and use it in GitHub Desktop.
Save ShigekiKarita/6703c4fff03b27b5d4fa to your computer and use it in GitHub Desktop.
妄想
import std.algorithm
auto deeper(T, U)(U[T][] records, U[][] maxElems)
{
// こういうのはこうかけるが
auto maxRec = records.map!values.reduce!max;
// こういうのはこうかくしか
auto nextRecords = maxElems
.map!(
es => es
.map!(
e => records
.filter!(
r => r
.values.any!(
x => x == e))));
return nextRecords;
}
// こうかけると楽しい?(いや楽しくない
// error: "multiple ! arguments are not allowed"
auto deeper(T, U)(T records, U maxElems)
{
auto nextRecords = maxElems.map!map!records.filter!values.any!equals;
return nextRecords;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment