# Source. (A:((L:range(10)) each()) , B:(L each())) collect(A + B = 10) # Semicolons for object definitions? Good. This reminds plain English: semicolons # should be inserted before explanations, like in this sentence. # But, in both English and Russian semicolons are often followed by whitespaces. (A: ((L: range(10)) each()) , B: (L each())) collect(A + B = 10) # Okay. Why not L: range(10), A: (L each()) , B: (L each()), collect(A + B = 10) # So now we really see that A and B are effectively the same thing. # Next. each() selects anything from L at once. Why then "each"? L: range(10), A: (L any()) , B: (L any()), collect(A + B = 10) # Or maybe L: range(10), A: any_from(L), B: any_from(L), collect(A + B = 10) # Poor little method collect(). It does too much: pattern-matching, list conversion... # Oh. L: range(10), A: any_from(L), B: any_from(L), C: select(A + B = 10), flatten(C) # Or L: range(10), A: any_from(L), B: any_from(L), C: selection(A + B = 10), flatten(C) # There remains only one problem. select() or collect()... what? "A + B = 10"?! # How to "collect" an equality? # Let me introduce you a "such ... that" operator. Let's call it "|". # Wait... Gods... this reminds me lambdas. I'm sorry. L: range(10), C: selection(A: any_from(L), B: any_from(L) | A + B = 10), flatten(C) # To show you why it is important, let me show you an example. # Suppose I'm to take only that nodes of L that make 10 with any node of M. collect(L + M = 10) # Nope, it will select nodes from both L and M collect(L = 10 - M) # Hey, mathematically it is the same thing! collect(L + M = 10 && L) # Unreadable. # But Now! This looks almost obvious even in one operation! flatten(selection(A: any_from(range(10)), B: any_from(range(10)) | A + B = 10)) # Almost jokingly. And one new method: the_same()! # (I didn't invent it, I've just restyled an "!!" operation from UNIX shell) flatten(selection(A: any_from(range(10)), B: the_same() | A + B = 10)) # Do you agree?