unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* parallel with no exprs
@ 2003-06-08 22:07 Kevin Ryde
  2003-06-09  8:35 ` Mikael Djurfeldt
  0 siblings, 1 reply; 7+ messages in thread
From: Kevin Ryde @ 2003-06-08 22:07 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 551 bytes --]

I tried using parallel with no expressions,

	(use-modules (ice-9 threads))
	(call-with-values
	    (lambda ()
	      (parallel))
	  (lambda ()
	    (display "hi\n")))

but got

	ERROR: In procedure lambda:
	ERROR: bad body

Is parallel allowed to be called with no expressions?  It'd be pretty
silly to write that deliberately, but perhaps it could arise from a
simple-minded macro expansion or something.

        * threads.scm (parallel): For no forms, use `(values)' not `(begin)'.

        * tests/threads.test: New file, exercising "parallel".


[-- Attachment #2: threads.scm.parallel-empty.diff --]
[-- Type: text/plain, Size: 334 bytes --]

--- threads.scm.~1.21.~	2003-04-28 07:51:19.000000000 +1000
+++ threads.scm	2003-06-08 14:31:57.000000000 +1000
@@ -182,7 +182,7 @@
 	%thread-handler)))
 
 (define-macro (parallel . forms)
-  (cond ((null? forms) '(begin))
+  (cond ((null? forms) '(values))
 	((null? (cdr forms)) (car forms))
 	(else
 	 (let ((vars (map (lambda (f)

[-- Attachment #3: threads.test --]
[-- Type: text/plain, Size: 1452 bytes --]

;;;; threads.test --- Tests for Guile threading.    -*- scheme -*-
;;;;
;;;; Copyright 2003 Free Software Foundation, Inc.
;;;;
;;;; This program is free software; you can redistribute it and/or modify
;;;; it under the terms of the GNU General Public License as published by
;;;; the Free Software Foundation; either version 2, or (at your option)
;;;; any later version.
;;;;
;;;; This program is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;;; GNU General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with this software; see the file COPYING.  If not, write to
;;;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
;;;; Boston, MA 02111-1307 USA

(use-modules (ice-9 threads)
	     (test-suite lib))


(with-test-prefix "parallel"
  (pass-if "0"
    (call-with-values
	(lambda ()
	  (parallel))
      (lambda ()
	#t)))
  
  (pass-if "1"
    (call-with-values
	(lambda ()
	  (parallel 1))
      (lambda (x)
	(equal? x 1))))
  
  (pass-if "1 2"
    (call-with-values
	(lambda ()
	  (parallel 1 2))
      (lambda (x y)
	(and (equal? x 1)
	     (equal? y 2)))))
  
  (pass-if "1 2 3"
    (call-with-values
	(lambda ()
	  (parallel 1 2 3))
      (lambda (x y z)
	(and (equal? x 1)
	     (equal? y 2)
	     (equal? z 3))))))

[-- Attachment #4: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-06-19  1:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-08 22:07 parallel with no exprs Kevin Ryde
2003-06-09  8:35 ` Mikael Djurfeldt
2003-06-12  1:54   ` Kevin Ryde
2003-06-12  9:27     ` Mikael Djurfeldt
2003-06-13 23:48       ` Kevin Ryde
2003-06-16 18:45         ` Mikael Djurfeldt
2003-06-19  1:40           ` Kevin Ryde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).