[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Another threading question



> Does exn_catching_apply run the thunk, or does it return a new thunk?
>

Yes -- it runs the thunk.
 
> More specifically, I'm guessing that you have
> 
>  (thread (exn-catching-apply (lambda () ... do work ...)))
> 
> and you need to thunk the application:
> 
>  (thread (lambda () (exn-catching-apply (lambda () ... do work ...))))
> 
> Probably you'll need to use scheme_make_closed_prim to implement the
> outer thunk.
>

I'll give that a shot.  Based on your description I'm optimistic that
this will resolve the issue.
 
> It would also explain the crash, since scheme_thread() gets a
> non-procedure.
> 

I must admit to being a bit confused, due to my stronger familiarity
with procedural programming.  I would have assumed that:

( (+ 1 2))

would be equivalent to:

(+ 1 2)

With the outer parenthesis being ignored.  But now I recognize that the
first example is actually asking the interpreter to evaluate the 
function (3), which is obviously in error.

Yes, that's probably Scheme (pre-Kindergarten) but oh well.

Thanks,

-Brent