srfi-13 define-macro replacements
Here are define-macro versions of `let-string-start+end' and `let-string-start+end2' needed by the reference implementation of srfi-13. I'm still reading over everyone else's work, so I don't know if these will be useful or not. ------------------------------------------------------------------------------- (define-macro (let-string-start+end start+end proc s-exp args-exp . body) (or (list? start+end) (error "let-string-start+end: start+end must be list")) (case (length start+end) ((2) `(receive ,start+end (string-parse-final-start+end ,proc ,s-exp ,args-exp) ,@body)) ((3) `(receive ,start+end (string-parse-start+end ,proc ,s-exp ,args-exp) ,@body)) (else (error "let-string-start+end: wrong length start+end")))) (define-macro (let-string-start+end2 start+end-pair proc str1 str2 args . body) (or (list? start+end-pair) (error "let-string-start+end: start+end-pair must be list")) (let ((rest (gensym)) (procv (gensym))) (receive (start1 end1 start2 end2) (apply values start+end-pair) `(let ((,procv ,proc)) ; Make sure PROC is only evaluated once. (let-string-start+end (,rest ,start1 ,end1) ,procv ,str1 ,args (let-string-start+end (,start2 ,end2) ,procv ,str2 ,rest ,@body)))))) ------------------------------------------------------------------------------- Regards, Ben
Afficher les réponses par date
Hello, this occurs, if I try out the example for serialized continuations: |*** ERROR IN "seri-conts.scm"@46.1 -- Uncaught exception: #<datum-parsing-exception #2> |(thread-join! '#<thread #3>) Here follows step for step what happened. - Take Version 4.0 beta 11 (I know that there is already beta 12, but I want to avoid the time consuming compilation, if not necessary). - Copy the code from Info node ``Readtables'' of gambit-c.info between ``Here is an example where continuations are serialized:'' and ``11100'' into a file with filename seri-conts.scm, clean it (erase system prompts, add a missing parenthesis etc. - see <http://hafner.sdf-eu.org/pool/seri-conts.scm> for the result). - Type ``gsi seri-conts.scm''. - The message above is rendered. - See <http://hafner.sdf-eu.org/pool/seri-conts.out> for the content of the variable s (i.e. that one holding the serialized continuation). My system is Debian 3.1, kernel 2.4.29 i686 GNU/Linux. Is it still a problem in beta 12? Regards Thomas Hafner
Hi, Looks like your `rd' procedure is borked. Try this: ---------------------------------------------------------------- (define (rd str) (call-with-input-string str (lambda (p) (input-port-readtable-set! p (readtable-sharing-allowed?-set (input-port-readtable p) 'serialize)) (read p)))) ---------------------------------------------------------------- I'm running 4b12, but I looked at the docs for 4b11 and the example is correct. Maybe your `rd' got messed up as you cut and pasted it? Regards, Ben On Sun, Mar 27, 2005 at 10:13:40PM +0200, hafner@sdf-eu.org wrote:
Hello,
this occurs, if I try out the example for serialized continuations: |*** ERROR IN "seri-conts.scm"@46.1 -- Uncaught exception: #<datum-parsing-exception #2> |(thread-join! '#<thread #3>)
Here follows step for step what happened.
- Take Version 4.0 beta 11 (I know that there is already beta 12, but I want to avoid the time consuming compilation, if not necessary).
- Copy the code from Info node ``Readtables'' of gambit-c.info between ``Here is an example where continuations are serialized:'' and ``11100'' into a file with filename seri-conts.scm, clean it (erase system prompts, add a missing parenthesis etc. - see <http://hafner.sdf-eu.org/pool/seri-conts.scm> for the result).
- Type ``gsi seri-conts.scm''.
- The message above is rendered.
- See <http://hafner.sdf-eu.org/pool/seri-conts.out> for the content of the variable s (i.e. that one holding the serialized continuation).
My system is Debian 3.1, kernel 2.4.29 i686 GNU/Linux.
Is it still a problem in beta 12?
Regards Thomas Hafner _______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca http://mailman.iro.umontreal.ca/mailman/listinfo/gambit-list
ben@fuhok.net wrote/schrieb <20050327214208.GA1433@fuhok.net>:
I'm running 4b12, but I looked at the docs for 4b11 and the example is correct. Maybe your `rd' got messed up as you cut and pasted it?
Yes, exactly. Shame on me that I'm not able to copy and paste. Thanks, and sorry for having disturbed. Thomas Hafner
participants (3)
-
ben@crickhollow.fuhok.net -
ben@fuhok.net -
hafner@sdf-eu.org