[Factor-talk] Defeated by a sample loop

2009-07-28 Thread Darrin Thompson
Last night I spent a couple of hours trying to find a clean way to implement this loop: http://code.google.com/apis/maps/articles/phpsqlgeocode.html#samplecode The main thing here is that each loop loop iteration is expensive, so whatever persistence mechanism is in place needs to happen right

Re: [Factor-talk] Defeated by a sample loop

2009-07-28 Thread Chris Double
On Wed, Jul 29, 2009 at 2:30 AM, Darrin Thompsondarri...@gmail.com wrote: I was bothered by the nagging idea that there was probably an important utility somewhere I was missing. In cases like this I run screaming to the locals vocab thereby at least removing the unbalanced branches

Re: [Factor-talk] Defeated by a sample loop

2009-07-28 Thread Darrin Thompson
On Tue, Jul 28, 2009 at 10:44 AM, Chris Doublechris.dou...@double.co.nz wrote: In cases like this I run screaming to the locals vocab thereby at least removing the unbalanced branches difficulties :-) Back in Python land I would run screaming to generators. Generators let you tease out little

Re: [Factor-talk] Defeated by a sample loop

2009-07-28 Thread David Goehrig
Darrin, The Google Maps geocoding API is one of the shittiest services they offer. The nested while loops are unnecessary btw, the one loop is iterating over the list of elements, and the other is waiting on a semaphor to see if it should keep retrying. The delay is due to that they rate limit

Re: [Factor-talk] Defeated by a sample loop

2009-07-28 Thread Darrin Thompson
On Tue, Jul 28, 2009 at 10:30 AM, Darrin Thompsondarri...@gmail.com wrote: I tried putting together a loop utility where the delay was increased and iteration retried every time the iteration threw a particular exception. But I was like try this and factor was like unbalanced branches and then

Re: [Factor-talk] Defeated by a sample loop

2009-07-28 Thread Slava Pestov
Perhaps instead of with-return/loop you could structure the word as a tail-recursive function. The way its coded right now it doesn't return the 'obj' parameter on the stack. If you make it tail recursive, you'll need to tell the compiler that 'quot' is a quotation, and declare it 'inline

Re: [Factor-talk] Defeated by a sample loop

2009-07-28 Thread Darrin Thompson
On Tue, Jul 28, 2009 at 9:02 PM, Slava Pestovsl...@factorcode.org wrote: Perhaps instead of with-return/loop you could structure the word as a tail-recursive function. The way its coded right now it doesn't return the 'obj' parameter on the stack. If you make it tail recursive, you'll need to

Re: [Factor-talk] Defeated by a sample loop

2009-07-28 Thread Slava Pestov
Yeah, the stack checker's error reporting leaves something to be desired... Slava On Tue, Jul 28, 2009 at 9:38 PM, Darrin Thompsondarri...@gmail.com wrote: Oops, I meant to try the code without param. That's a relic earlier hacking with it. As it stands I was able to feed the geocoder to it