Skip to content

Instantly share code, notes, and snippets.

@C8Luna
Last active August 29, 2015 14:21
Show Gist options
  • Save C8Luna/c97ff4f5fc98a81ee2b2 to your computer and use it in GitHub Desktop.
Save C8Luna/c97ff4f5fc98a81ee2b2 to your computer and use it in GitHub Desktop.
Per Using Monads _The List Monad(pretty)
var q = (
from s in Enumerable.Range(0, 10)
from e in Enumerable.Range(0, 10)
from n in Enumerable.Range(0, 10)
from d in Enumerable.Range(0, 10)
from m in Enumerable.Range(0, 10)
from o in Enumerable.Range(0, 10)
from r in Enumerable.Range(0, 10)
from y in Enumerable.Range(0, 10)
let t1=int.Parse(string.Format("{0}{1}{2}{3}",s,e,n,d))
let t2=int.Parse(string.Format("{0}{1}{2}{3}",m,o,r,e))
let r0=int.Parse(string.Format("{0}{1}{2}{3}{4}",m,o,n,e,y))
where t1+t2==r0 &&
s != e && s != n && s != d && s != m && s != o && s != r && s != y &&
e != n && e != d && e != m && e != o && e != r && e != y &&
n != d && n != m && n != o && n != r && n != y &&
d != m && d != o && d != r && d != y &&
m != o && m != r && m != y &&
o != r && o != y &&
r != y
select new {t1,t2,r0,s, e, n, d, m, o, r, y});
var result = q.ToList();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment