Created
November 7, 2020 16:10
-
-
Save daniellansun/9d0235a84f28f2c396b4c12cb78304c0 to your computer and use it in GitHub Desktop.
Generate Multiplication Table with GINQ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GQ { | |
from v in ( | |
from a in 1..9 | |
innerjoin b in 1..9 on a <= b | |
select a as f, b as s, "$a * $b = ${a * b}".toString() as r | |
) | |
groupby v.s | |
select max(v.f == 1 ? v.r : '') as v1, | |
max(v.f == 2 ? v.r : '') as v2, | |
max(v.f == 3 ? v.r : '') as v3, | |
max(v.f == 4 ? v.r : '') as v4, | |
max(v.f == 5 ? v.r : '') as v5, | |
max(v.f == 6 ? v.r : '') as v6, | |
max(v.f == 7 ? v.r : '') as v7, | |
max(v.f == 8 ? v.r : '') as v8, | |
max(v.f == 9 ? v.r : '') as v9 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That does it.