wait reduce [listen 0]

Started by limux on 17-May-2011/12:22:57-7:00
I am reading webserv.r of Cal Dixon, Would someone like to explain the code line show below: if none? wait reduce [ listen 0 ] [ return ] What confused me is wait reduce [listen 0]! THANKS
I have read the port chapter of the rebol core guide, and know that "wait [listen 0]" is to wait listen with 0 of timeout, but I don't know why use reduce? The "wait [listen 0]" worked same as with reduce exactly, Is my understanding right?
The interpretation depends on the value of the LISTEN word. It is likely that it holds the network port that the web server is listening on. LISTEN as an unreduced symbol does not specify any port, so it doesn't work that way. WAIT can then only wait until the timeout, which is immediately, so it becomes a useless operation.
Would you like to give a simaple example?//
Well, you have a simple example right there. How could it be made simpler?
listen: open udp://:2552 wait reduce [listen 10] copy listen type? first [listen 10] ; >> word! type? first reduce [listen 10] ; >> port! But actually wait already take care about it. wait [listen 10] ;this also works May be older versions of Rebol act different.

Reply