Code from Marc Feeley's Scheme 2001 paper.
This commit is contained in:
		
							parent
							
								
									8dc4af1e38
								
							
						
					
					
						commit
						60069b30d4
					
				|  | @ -0,0 +1,18 @@ | |||
| 
 | ||||
| ;; Taken from Marc Feeley's paper "A Better API for First-Class Continunations" | ||||
| ;; The version from the workshop proceedings contains a bug in continuation-capture. | ||||
| ;; This is the corrected version. | ||||
| 
 | ||||
| (define (continuation-capture receiver) | ||||
|   ((call-with-current-continuation | ||||
|     (lambda (cont) | ||||
|       (lambda () (receiver cont)))))) | ||||
| 
 | ||||
| (define (continuation-graft cont thunk) | ||||
|   (cont thunk)) | ||||
| 
 | ||||
| (define (continuation-return cont . returned-values) | ||||
|   (continuation-graft | ||||
|    cont | ||||
|    (lambda () (apply values returned-values)))) | ||||
| 
 | ||||
|  | @ -0,0 +1,4 @@ | |||
| (define-interface continuation-data-type-interface | ||||
|   (export continuation-capture | ||||
| 	  continuation-graft | ||||
| 	  continuation-return)) | ||||
|  | @ -0,0 +1,3 @@ | |||
| (define-structure continuation-data-type continuation-data-type-interface | ||||
|   (open scheme) | ||||
|   (files continuation-data-type)) | ||||
		Loading…
	
		Reference in New Issue
	
	 Martin Gasbichler
						Martin Gasbichler