Hi, In Gambit 4.7.2 documentation, in the section dedicated to threads, there is the following code example :
(define thread-alive? (let ((unique (list ’unique)))
(lambda (thread) ; Note: this procedure raises an exception if ; the thread terminated abnormally. (eq? (thread-join! thread 0 unique) unique))))This code is actually incorrect (according to gsi), the let is rejected. I believe that :(define thread-alive? (lambda (thread) (eq? (thread-join! thread 0 'unique) 'unique))) should be enough (though I do not know what happens if the thread returns nothing). I would like to know if there was some precise reason behind this let construction.Thanks, Denis
Afficher les réponses par date
Denis, the unique variable is for it to work even if the thread ended its execution by returning a symbol by the name unique - it interprets fine, what's your err?
2014-05-12 2:38 GMT+02:00 Denis Fourt denis.prog@hotmail.com:
Hi,
In Gambit 4.7.2 documentation, in the section dedicated to threads, there is the following code example :
(define thread-alive? (let ((unique (list 'unique)))
(lambda (thread) ; Note: this procedure raises an exception if ; the thread terminated abnormally. (eq? (thread-join! thread 0 unique) unique))))
This code is actually incorrect (according to gsi), the let is rejected. I believe that :
(define thread-alive?
(lambda (thread)
(eq? (thread-join! thread 0 'unique) 'unique)))
should be enough (though I do not know what happens if the thread returns nothing). I would like to know if there was some precise reason behind this let construction.
Thanks,
Denis
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Hi, my error was that the "quote" was actually a different unicode char (from the copy/paste), therefore gsi did not understand it as a quoted symbol but as an unquoted (undefined) symbol. And I got a weird error message because of the code point of that char was written right in it. And I have to admit it, I had no clue about what was occurring. I understand that no thread could return anything that would be eq? with (let ((unique (list 'unique))). But : a) Is there anything more simple than using list? b) Would it be a good idea to have one (or more) reserved symbol (or keyword) in Gambit like None, Nothing, Fail, etc. to handle that kind of problem. I am asking this question because a similar problem arises with hash table or similar dictionary like structures. Most of the time #f or '() work except when storing booleans or lists. Any thoughts? Denis
From: mikael.rcv@gmail.com Date: Mon, 12 May 2014 14:33:44 +0200 Subject: Re: [gambit-list] example from the doc To: denis.prog@hotmail.com; gambit-list@iro.umontreal.ca
Denis, the unique variable is for it to work even if the thread ended its execution by returning a symbol by the name unique - it interprets fine, what's your err?
2014-05-12 2:38 GMT+02:00 Denis Fourt denis.prog@hotmail.com:
Hi, In Gambit 4.7.2 documentation, in the section dedicated to threads, there is the following code example :
(define thread-alive? (let ((unique (list ’unique)))
(lambda (thread) ; Note: this procedure raises an exception if ; the thread terminated abnormally. (eq? (thread-join! thread 0 unique) unique))))This code is actually incorrect (according to gsi), the let is rejected. I believe that :(define thread-alive? (lambda (thread) (eq? (thread-join! thread 0 'unique) 'unique)))
should be enough (though I do not know what happens if the thread returns nothing). I would like to know if there was some precise reason behind this let construction.
Thanks, Denis
_______________________________________________
Gambit-list mailing list
Gambit-list@iro.umontreal.ca
https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
2014-05-12 19:55 GMT+02:00 Denis Fourt denis.prog@hotmail.com:
Hi,
my error was that the "quote" was actually a different unicode char (from the copy/paste), therefore gsi did not understand it as a quoted symbol but as an unquoted (undefined) symbol.
And I got a weird error message because of the code point of that char was written right in it. And I have to admit it, I had no clue about what was occurring.
I understand that no thread could return anything that would be eq? with (let ((unique (list 'unique))). But :
a) Is there anything more simple than using list?
Uninterned sy.
b) Would it be a good idea to have one (or more) reserved symbol (or
keyword) in Gambit like None, Nothing, Fail, etc. to handle that kind of problem. I am asking this question because a similar problem arises with hash table or similar dictionary like structures. Most of the time #f or '() work except when storing booleans or lists.
No just use a unique object for this purpose - if there'd be a global undefined value, then of course you'd get the same uniqueness problems with it as with a global symbol like 'undefined , or #f etc.
Any thoughts?
Denis
From: mikael.rcv@gmail.com Date: Mon, 12 May 2014 14:33:44 +0200 Subject: Re: [gambit-list] example from the doc To: denis.prog@hotmail.com; gambit-list@iro.umontreal.ca
Denis, the unique variable is for it to work even if the thread ended its execution by returning a symbol by the name unique - it interprets fine, what's your err?
2014-05-12 2:38 GMT+02:00 Denis Fourt denis.prog@hotmail.com:
Hi,
In Gambit 4.7.2 documentation, in the section dedicated to threads, there is the following code example :
(define thread-alive? (let ((unique (list 'unique)))
(lambda (thread) ; Note: this procedure raises an exception if ; the thread terminated abnormally. (eq? (thread-join! thread 0 unique) unique))))
This code is actually incorrect (according to gsi), the let is rejected. I believe that :
(define thread-alive?
(lambda (thread)
(eq? (thread-join! thread 0 'unique) 'unique)))
should be enough (though I do not know what happens if the thread returns nothing). I would like to know if there was some precise reason behind this let construction.
Thanks,
Denis
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
On May 12, 2014, at 1:55 PM, Denis Fourt denis.prog@hotmail.com wrote:
Hi,
my error was that the "quote" was actually a different unicode char (from the copy/paste), therefore gsi did not understand it as a quoted symbol but as an unquoted (undefined) symbol.
Ah yes! Copy pasting Scheme code from the PDF manual is not a good idea, in particular because the single quote character is replaced by latex by a different quote (perhaps because it looks better, i.e. more slanted).
It seems to be fine to copy/paster from the HTML manual though.
Marc