>>1 its just packaging up self application in a nice way
Name:
Anonymous2015-04-26 22:32
I'm a 33 year old virgin.
Name:
Anonymous2015-04-26 23:29
>>1 The Y combinator takes a function f. Then it calls f on itself. So f's first parameter is f itself. Then f can make a recursive call if it wants to by calling its first parameter.
Name:
Anonymous2015-04-27 1:56
"So f's first parameter is f itself"
that's not quite right, it's a delayed version of (y f) that gets passed in
Name:
Anonymous2015-04-27 2:09
Sometimes /prog/ is full of threads I don't understand because they're talking about hipster language shit that popular languages don't have. I'm looking at you, Lispers
Oh, I just understood. You're right. My mistake. You can make it work by just passing f though. Then recursive calls look like (f f 3) instead of (f 3).
I actually enjoy FIOC and even use Coffeescript (FIOC for JS)
Name:
Anonymous2015-04-27 7:41
I can't understand delimited continuations no matter how hard I try.
Name:
Anonymous2015-04-27 7:44
The Y combinator provides seed funding for startups. Seed funding is the earliest stage of venture funding. It pays your expenses while you're getting started.
Some companies may need no more than seed funding. Others will go through several rounds. There is no right answer; how much funding you need depends on the kind of company you start.
The Y combinator's goal is to get you through the first phase. This usually means: get you to the point where you've built something impressive enough to raise money on a larger scale. Then we can introduce you to later stage investors—or occasionally even acquirers.
Name:
Anonymous2015-04-27 11:09
>>12 You probably mean "unsarcastically". Your unsarcastic usage of void.h was ironic.
Name:
Anonymous2015-04-27 14:47
>>14 they are far simpler than call/cc - have you seen the rewrite laws that explain how they work?
Name:
Anonymous2015-04-27 14:56
>>17 Well, I don't understand call/cc either. What rewrite laws?
>>19 Thanks, but I still can't quite get what's going on. I've gotten to do Exercise 4, it's a function that finds the product of numbers in a list but short-circuits if it sees a 0.
It's supposed to print only non-zero elements of the list. The continuation k is called only in the branch where the car of the list is non-zero, right? But when I run (product-delim '(2 4 0 1 2 3)), I get the output
2 4 0 0
The last zero is the end result, but the first one is the element of the list. But why does it print the zero element? I don't get it.
Name:
Anonymous2015-04-27 17:59
>>24 You're doing a complicated "tail recursive with accumulator" version - that lets you easily do an early exit without using continuations.
The idea of the exercise is to start with a normal, direct style version of product:
and then insert a shift (fun _ -> M) to discard the continuation in the case where you see a 0.
Name:
Anonymous2015-04-27 18:15
>>21 Which Visual Studio is your favorite? Mine is Universal Studios.
Name:
Anonymous2015-04-27 18:30
>>25 But I still don't understand my code. Which means I don't understand delim. conts as a whole.
Can you explain where I'm wrong if I simplify the question?
In the below snippet, when the "if" takes the "true" branch, why does (some-foo) get called? Didn't we discard the continuation in that branch?
(reset (some-foo) (shift k (if (...) 0 (k ...)))
Name:
Anonymous2015-04-27 18:57
inside reset is an implicit begin: (begin (some-foo) (shift k ...)) so it will run some-foo always.
If you would do it this way instead, maybe it will act how you expected:
(define (fook v) (begin (some-foo) v))
(fook (shift k ...))
Basically: You have the right idea but got bit by an unusual situation with an implicit special form. Don't worry about it - try to solve ex 4 in the intended way.
Name:
Anonymous2015-04-27 19:07
>>28 Ah, so it was the begin. Now I get it, thanks.
Name:
Anonymous2015-04-27 20:24
Basically, Y is a function that applies a function F (which expects some recursive function as it's first argument), to itself.
(define (y f) (f (y f)))
this only works in lazy languages though, otherwise Y will continually be called recursively until the stack blows up.
To make it work in strict languages you have to add another layer of indirection. Rather than passing (Y f) to the function, you pass a function (called Z) that when called will again call the original function with a newly created version of Z, which again will pass a new version of itself into F, ad infinitum, but the infinite recursion only recurs stepwise as necessary this time, as it is delayed behind a lambda indirection.
(define (y f) ;; always pass a copy of this function to itself (let ((make-wrapped-func (lambda (wrapper-maker) (lambda (arg) ;; original function's argument
;; next-wrapped-func is equivalent to the function we're current evaluationg (let ((next-wrapped-func (wrapper-maker wrapper-maker))) ;; call original func with wrapped func (which will in turn call it again with a wrapped func, if necessary) ;; then pass in the argument ((f next-wrapped-func) arg)))))) (make-wrapped-func make-wrapped-func)))
I've never liked the Y combinator, or any of the hardline functional programming shit that leads to such ridiculous crap. If I wanted to λ calculus, I would do actual λ calculus, not half ass it in Scheme. Sure, it's good to understand and is important to have some knowledge about, but I will never pollute my toy programs with such hideous stuff. I am not a trash compactor for such programmatic garbage.
Name:
Anonymous2015-04-28 4:25
>>37 If you've got too much trash to compact, why don't you unload it into my anus!