Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- taking notes while examining the structure, this is when I finally figured out how "two arguments were passed"
- -- through the "f" and "x" functions
- call a function(1)
- f1()
- that function is the result of another(2) function being called with a third(B) function
- f1 = f2(B)
- the second(2) function returns function(f) called with a forth(A) function
- f2 = return ff(A)
- function(x) is defined by a call to its bound function(F)
- fx = F(x)
- function(f) binds the passed function and returns function(x)
- ff = fx(F)
- finally, function(f) is called with function(A) (SEE ABOVE)
- f1() -> f2(B) -> ff(A)(B) ->
- fx(A)(B) -> A(B) -> B
- ff(A) really means F = A & call fx(B)
- -- nesting to try to understand it better
- (1
- (2
- (λ f .
- (λ x .
- (f x)
- )
- )
- (λ a . a)
- )
- (λ b . b)
- )
- -- attempting a syntax that I understand better
- λ x . (f x) => fn X(x) { return f(x) }
- λ f . X f-bound => fn F(f) { return X(f) }
- λ a . a => fn A(a) { return a }
- λ b . b => fn B(b) { return b }
- anon creates F, calls it with A, then calls the result with B
- (F(A))(B)
- -- literally going in circles
- F(A) -> X(A)
- X(A) -> F(A)
- ?
- -- trying to distinguish between defining functions and calling them
- (
- def(
- def(λ F .
- def(λ X .
- call(F X)
- )
- )
- call(A)
- )
- call(B)
- )
- -- still not realizing that "x" and "f" functions are more dynamic than I expected
- anon1 = { return F(A) }
- F = (F){ return (X){ F(X) } }
- X = (X){ return F(X) }
- A = (A){ return A }
- B = (B){ return B }
- anon1(B)
- F(B)
- λ X . (F X)
- -- THIS is when I finally got the whole thing
- ( ( (λ f . (λ x . (f x) ) ) (λ a . a) ) (λ b . b) )
- B = fn(b) -> return b
- A = fn(a) -> return a
- (λ f . (λ x . (f x) ) ) A B
- F = fn(f) -> return (λ x . (f x) )
- F(A)B
- λ x . (A x) B
- X = fn(x) -> return A(x)
- X(B) => A(B) => B
- λ x . f x OR λ x . (f x) OR "(x) -> f(x)" OR f
- "functions are equal if they give the same results on all inputs"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement